Sha256: febedc49b73675882c4c92268c242d50be0e5235a314751f5928ecb292e2f154

Contents?: true

Size: 926 Bytes

Versions: 16

Compression:

Stored size: 926 Bytes

Contents

module Rspec
  module Matchers
    # :call-seq:
    #   should eq(expected)
    #   should_not eq(expected)
    #
    # Passes if actual == expected.
    #
    # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby.
    #
    # == Examples
    #
    #   5.should eq(5)
    #   5.should_not eq(3)
    def eq(expected)
      Matcher.new :eq, expected do |_expected_|
        match do |actual|
          actual == _expected_
        end

        failure_message_for_should do |actual|
          <<-MESSAGE

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

(compared using ==)
MESSAGE
        end

        failure_message_for_should_not do |actual|
          <<-MESSAGE

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

(compared using ==)
MESSAGE
        end

        description do
          "== #{_expected_}"
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rspec-expectations-2.0.0.beta.8 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.beta.7 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.beta.6 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.beta.5 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.beta.4 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.beta.3 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.beta.2 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.beta.1 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.a10 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.a9 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.a8 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.a7 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.a6 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.a5 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.a4 lib/rspec/matchers/eq.rb
rspec-expectations-2.0.0.a3 lib/rspec/matchers/eq.rb