Sha256: c6085b4927622107f4b45d0ab0c4ac2bd7aa507baf9df0432adbfc16b7485f02

Contents?: true

Size: 1.12 KB

Versions: 47

Compression:

Stored size: 1.12 KB

Contents

module Spec
  module Matchers
  
    class Equal #:nodoc:
      def initialize(expected)
        @expected = expected
      end
  
      def matches?(actual)
        @actual = actual
        @actual.equal?(@expected)
      end

      def failure_message
        return "expected #{@expected.inspect}, got #{@actual.inspect} (using .equal?)", @expected, @actual
      end

      def negative_failure_message
        return "expected #{@actual.inspect} not to equal #{@expected.inspect} (using .equal?)", @expected, @actual
      end
      
      def description
        "equal #{@expected.inspect}"
      end
    end
    
    # :call-seq:
    #   should equal(expected)
    #   should_not equal(expected)
    #
    # Passes if actual and expected are the same object (object identity).
    #
    # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more information about equality in Ruby.
    #
    # == Examples
    #
    #   5.should equal(5) #Fixnums are equal
    #   "5".should_not equal("5") #Strings that look the same are not the same object
    def equal(expected)
      Matchers::Equal.new(expected)
    end
  end
end

Version data entries

47 entries across 47 versions & 9 rubygems

Version Path
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/lib/spec/matchers/equal.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/lib/spec/matchers/equal.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/lib/spec/matchers/equal.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/lib/spec/matchers/equal.rb
deckshuffler-0.0.2 vendor/plugins/rspec/lib/spec/matchers/equal.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec/lib/spec/matchers/equal.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec/lib/spec/matchers/equal.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec/lib/spec/matchers/equal.rb
picolena-0.0.99 app_generators/picolena/templates/vendor/plugins/rspec/lib/spec/matchers/equal.rb
picolena-0.1.1 rails_plugins/rspec/lib/spec/matchers/equal.rb
picolena-0.1.0 rails_plugins/rspec/lib/spec/matchers/equal.rb
picolena-0.1.3 rails_plugins/rspec/lib/spec/matchers/equal.rb
picolena-0.1.4 rails_plugins/rspec/lib/spec/matchers/equal.rb
picolena-0.1.2 rails_plugins/rspec/lib/spec/matchers/equal.rb
picolena-0.1.5 rails_plugins/rspec/lib/spec/matchers/equal.rb
pictrails-0.5.0 vendor/plugins/rspec/lib/spec/matchers/equal.rb
radiant-0.6.5.1 vendor/plugins/rspec/lib/spec/matchers/equal.rb
radiant-0.6.5 vendor/plugins/rspec/lib/spec/matchers/equal.rb
radiant-0.6.7 vendor/plugins/rspec/lib/spec/matchers/equal.rb
radiant-0.6.6 vendor/plugins/rspec/lib/spec/matchers/equal.rb