Sha256: 2e744b1d3f5ef92e0b839e3db38f125b7810f54b4a3264451b50bebdc0df34f9

Contents?: true

Size: 805 Bytes

Versions: 7

Compression:

Stored size: 805 Bytes

Contents

module RSpec
  module Matchers
    class Eql
      include BaseMatcher

      def matches?(actual)
        super(actual).eql?(expected)
      end

      def failure_message_for_should
        "\nexpected: #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
      end

      def failure_message_for_should_not
        "\nexpected: value != #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
      end

      def diffable?
        true
      end
    end

    # Passes if +actual.eql?(expected)+
    #
    # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby.
    #
    # @example
    #
    #   5.should eql(5)
    #   5.should_not eql(3)
    def eql(expected)
      Eql.new(expected)
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-expectations-2.8.0/lib/rspec/matchers/eql.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/rspec-expectations-2.8.0/lib/rspec/matchers/eql.rb
horseman-0.0.4 vendor/ruby/1.9.1/gems/rspec-expectations-2.8.0/lib/rspec/matchers/eql.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/rspec-expectations-2.8.0/lib/rspec/matchers/eql.rb
rspec-expectations-2.8.0 lib/rspec/matchers/eql.rb
rspec-expectations-2.8.0.rc2 lib/rspec/matchers/eql.rb
rspec-expectations-2.8.0.rc1 lib/rspec/matchers/eql.rb