lib/pundit/rspec.rb in pundit-0.2.2 vs lib/pundit/rspec.rb in pundit-0.2.3
- old
+ new
@@ -19,10 +19,11 @@
failure_message_for_should_not do |policy|
"Expected #{policy} not to grant #{permissions.to_sentence} on #{record} but it did"
end
def permissions
- example.metadata[:permissions]
+ current_example = ::RSpec.respond_to?(:current_example) ? ::RSpec.current_example : example
+ current_example.metadata[:permissions]
end
end
end
module DSL