Sha256: 66a441bcaffa614f842c2568e821df7058b538106f9e0c37fc48965e369bcfe3

Contents?: true

Size: 949 Bytes

Versions: 34

Compression:

Stored size: 949 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_|

        diffable

        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

34 entries across 34 versions & 4 rubygems

Version Path
rspec-expectations-2.7.0.rc1 lib/rspec/matchers/eql.rb
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/lib/rspec/matchers/eql.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rspec-expectations-2.5.0/lib/rspec/matchers/eql.rb
rspec-expectations-2.6.0 lib/rspec/matchers/eql.rb
rspec-expectations-2.6.0.rc6 lib/rspec/matchers/eql.rb
rspec-expectations-2.6.0.rc4 lib/rspec/matchers/eql.rb
rspec-expectations-2.6.0.rc2 lib/rspec/matchers/eql.rb
rspec-expectations-2.5.0 lib/rspec/matchers/eql.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/lib/rspec/matchers/eql.rb
rspec-expectations-2.4.0 lib/rspec/matchers/eql.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/lib/rspec/matchers/eql.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/lib/rspec/matchers/eql.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/lib/rspec/matchers/eql.rb
rspec-expectations-2.3.0 lib/rspec/matchers/eql.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/lib/rspec/matchers/eql.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/lib/rspec/matchers/eql.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-expectations-2.1.0/lib/rspec/matchers/eql.rb
rspec-expectations-2.2.0 lib/rspec/matchers/eql.rb
rspec-expectations-2.1.0 lib/rspec/matchers/eql.rb
rspec-expectations-2.0.1 lib/rspec/matchers/eql.rb