add be_able_to matcher
This commit is contained in:
committed by
Ryan Bates
parent
35c4864de4
commit
cf49c5b9de
13
lib/cancan/matchers.rb
Normal file
13
lib/cancan/matchers.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
Spec::Matchers.define :be_able_to do |action, subject|
|
||||
match do |model|
|
||||
model.can?(action, subject)
|
||||
end
|
||||
|
||||
failure_message_for_should do |model|
|
||||
"expected to be able to #{action.inspect} #{subject.inspect}"
|
||||
end
|
||||
|
||||
failure_message_for_should_not do |model|
|
||||
"expected not to be able to #{action.inspect} #{subject.inspect}"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user