add be_able_to matcher

This commit is contained in:
David Chelimsky
2010-04-13 21:02:39 +08:00
committed by Ryan Bates
parent 35c4864de4
commit cf49c5b9de
3 changed files with 39 additions and 0 deletions

13
lib/cancan/matchers.rb Normal file
View 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