forked from thoughtbot/paperclip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor previous into its own matcher
- Loading branch information
Jon Yurek
committed
Sep 25, 2014
1 parent
6ea7c26
commit 3ec2599
Showing
2 changed files
with
27 additions
and
22 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
RSpec::Matchers.define :have_column do |column_name| | ||
chain :with_default do |default| | ||
@default = default | ||
end | ||
|
||
match do |columns| | ||
column = columns.detect{|column| column.name == column_name } | ||
column && column.default == @default | ||
end | ||
|
||
failure_message_for_should do |columns| | ||
"expected to find #{column_name}, default #{@default} in #{columns.map{|column| [column.name, column.default] }}" | ||
end | ||
end |