allow additional arguments for be_able_to matcher, this requires Ruby 1.8.7 or higher to use matcher
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
Spec::Matchers.define :be_able_to do |action, subject|
|
||||
Spec::Matchers.define :be_able_to do |*args|
|
||||
match do |model|
|
||||
model.can?(action, subject)
|
||||
model.can?(*args)
|
||||
end
|
||||
|
||||
failure_message_for_should do |model|
|
||||
"expected to be able to #{action.inspect} #{subject.inspect}"
|
||||
"expected to be able to #{args.map(&:inspect).join(" ")}"
|
||||
end
|
||||
|
||||
failure_message_for_should_not do |model|
|
||||
"expected not to be able to #{action.inspect} #{subject.inspect}"
|
||||
"expected not to be able to #{args.map(&:inspect).join(" ")}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user