thingspeak/spec/support/matchers/simple_matcher.rb

22 lines
453 B
Ruby
Raw Normal View History

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