Closed martingregoire closed 2 years ago
Thanks for the report.
Pundit is (at least in principle) not a rails-specific gem and as far as we can see pundit/rspec
doesn't depend on anything in Rails.
Pundit policies don't (by default) include anything from the Rails framework, so it should be possible to test them in isolation without loading the whole Rails application (ie. by requiring only spec_helper.rb
and not rails_helper.rb
).
Could the issue be that you're running rspec
rather than bundle exec rspec
, so you're not using the version of RSpec which you're expecting?
Alternatively this could be the result of some issue in how your spec_helper.rb
or rails_helper.rb
are constructed.
Have a look into that and get back to us if that doesn't solve it.
Closing due to lack of response: please reopen if you have more information.
Is it the case that spec_helper.rb
doesn't require bundler/setup
?
In the README file for RSpec it says:
While this works in my project (I can use the
permissions
helper in a policy spec file in thespec/policies/
folder), it renders a warning when running any spec:Running
gem cleanup minitest
orgem cleanup
does not resolve the warning.I found this related issue: https://github.com/rubygems/rubygems/issues/1267#issuecomment-196180872
Suggestion
When moving the
require
call from thespec_helper.rb
to therails_helper.rb
file, the warning is no longer shown.Should the README be updated accordingly? In
rails_helper.rb
we see this line, which could be quoted in the README:Environment
Some more information (not sure if relevant):