X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/ddd5b4cf19a92582fd114914be5bd5a04d3522a7..3f607d565bc0e2c7b1b738301c11c16d069913d5:/vendor/gems/rspec-1.1.2/lib/spec/matchers/eql.rb diff --git a/vendor/gems/rspec-1.1.2/lib/spec/matchers/eql.rb b/vendor/gems/rspec-1.1.2/lib/spec/matchers/eql.rb new file mode 100644 index 000000000..280ca5454 --- /dev/null +++ b/vendor/gems/rspec-1.1.2/lib/spec/matchers/eql.rb @@ -0,0 +1,43 @@ +module Spec + module Matchers + + class Eql #:nodoc: + def initialize(expected) + @expected = expected + end + + def matches?(actual) + @actual = actual + @actual.eql?(@expected) + end + + def failure_message + return "expected #{@expected.inspect}, got #{@actual.inspect} (using .eql?)", @expected, @actual + end + + def negative_failure_message + return "expected #{@actual.inspect} not to equal #{@expected.inspect} (using .eql?)", @expected, @actual + end + + def description + "eql #{@expected.inspect}" + end + end + + # :call-seq: + # should eql(expected) + # should_not eql(expected) + # + # Passes if actual and expected are of equal value, but not necessarily the same object. + # + # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby. + # + # == Examples + # + # 5.should eql(5) + # 5.should_not eql(3) + def eql(expected) + Matchers::Eql.new(expected) + end + end +end