This repository has been archived by the owner on Dec 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow additional arguments for be_able_to matcher, this requires Ruby…
… 1.8.7 or higher to use matcher
- Loading branch information
Showing
3 changed files
with
14 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters