thoughtbot/shoulda-context

Doesn't work without Rails

Closed this issue · 4 comments

If I require "shoulda-context" in my gem where I'm using MiniTest but not Rails, shoulda-context is never loaded. My discovery is that shoulda-context only attaches itself to MiniTest if Rails is present, if not, MiniTest is ignored.

Am I missing something here? If not, I can provide more information and/or attempt a patch.

See also #33

EDIT: actually, I'm not sure if this is related to #33.

@pupeno I'm not able to get this working on a ruby project without Rails as well. Were you able to figure it out?

Gemfile:

group :test do
  gem 'minitest'
  gem 'shoulda'
end

Test file:

require 'test_helper'
class MyTest < Minitest::Test
  setup do
    ...
  end

  should 'do something' do
    ...
  end
end

I get an undefined method "setup" error.

I realize this is an old issue but I've got some new updates available for shoulda and shoulda-context that may fix this. To get these, try shoulda 4.0.0.rc1. Please let me know if you have any more trouble using Shoulda with a non-Rails project!

I just released Shoulda 4.0.0. This upgrades the dependency on shoulda-context to 2.0.0 as well as shoulda-matchers to ~> 4.0, both of which add proper support for Rails 5 and 6. Closing this now, but if you see any more issues don't hesitate to file them!