Sha256: a56028e62c485e03d3cfb18bdadad7ef41986fdcc590bf8f9cd1f86ea148e037

Contents?: true

Size: 930 Bytes

Versions: 12

Compression:

Stored size: 930 Bytes

Contents

module RSpec
  module Matchers
    # :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)
      Matcher.new :eql, expected do |_expected_|
        match do |actual|
          actual.eql?(_expected_)
        end

        failure_message_for_should do |actual|
          <<-MESSAGE

expected #{_expected_.inspect}
     got #{actual.inspect}

(compared using eql?)
MESSAGE
        end

        failure_message_for_should_not do |actual|
          <<-MESSAGE

expected #{actual.inspect} not to equal #{_expected_.inspect}

(compared using eql?)
MESSAGE
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rspec-expectations-2.0.0.beta.20 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.19 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.18 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.17 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.16 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.15 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.14 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.13 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.12 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.11 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.10 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.0.beta.9 lib/rspec/matchers/eql.rb