You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi.
I'm using pundit(0.2.1) with rspec-rails(~2.14) in my rails 4 projects
It's great to use it with policy and view specs. But I confuse with controller and feature(capybara 2) types
When running tests I got errors: undefined method 'authorize' for #<ArticlesController:0xb9b39fc> # ./app/controllers/articles_controller.rb:6:in 'show' # ./spec/features/authentication_spec.rb:6:in 'block (3 levels) in <top (required)>'
The same thing with my capybara feature.
But it works in development mode.
I found interesting hook that fixes controller group problem only. But I don't like it
# spec_helper.rb
config.before do
if defined?(controller)
controller.extend Pundit
end
end
Thanks for any help and ideas
The text was updated successfully, but these errors were encountered:
I can't think of any reason Pundit would be included in your dev environment, and not in test, aside from maybe weird load-order/autoloading stuff? We don't really do anything fancy with module in Pundit, just plain old Ruby, so I don't think there is anything we can or should do about this.
Hi.
I'm using pundit(0.2.1) with rspec-rails(~2.14) in my rails 4 projects
It's great to use it with policy and view specs. But I confuse with controller and feature(capybara 2) types
When running tests I got errors:
undefined method 'authorize' for #<ArticlesController:0xb9b39fc>
# ./app/controllers/articles_controller.rb:6:in 'show'
# ./spec/features/authentication_spec.rb:6:in 'block (3 levels) in <top (required)>'
The same thing with my capybara feature.
But it works in development mode.
I found interesting hook that fixes controller group problem only. But I don't like it
Thanks for any help and ideas
The text was updated successfully, but these errors were encountered: