update with changes from Production branch
This commit is contained in:
21
spec/support/matchers/simple_matcher.rb
Normal file
21
spec/support/matchers/simple_matcher.rb
Normal file
@ -0,0 +1,21 @@
|
||||
RSpec::Matchers.define :be_even do
|
||||
match do |given|
|
||||
given % 2 == 0
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
RSpec::Matchers.define :have_ids_of do |objects|
|
||||
match do |given|
|
||||
(given.map &:id).sort.should == (objects.map &:id).sort
|
||||
end
|
||||
end
|
||||
|
||||
# def should_have_ids_of(objcts)
|
||||
# simple_matcher("should have id of"){|given | (given.map &:id).sort.should == (objects.map &:id).sort}
|
||||
# end
|
||||
#
|
||||
# def be_even
|
||||
# simple_matcher("an even number") { |given| given % 2 == 0 }
|
||||
# end
|
Reference in New Issue
Block a user