Sha256: 2d2a444ae97153bafac2d963618f2364977f6cc3c3dd291639c7119b4641e950

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'

module Spec
  module Matchers
    describe "equal" do
      it "should match when actual.equal?(expected)" do
        1.should equal(1)
      end

      it "should not match when !actual.equal?(expected)" do
        1.should_not equal("1")
      end
      
      it "should describe itself" do
        matcher = equal(1)
        matcher.matches?(1)
        matcher.description.should == "equal 1"
      end
      
      it "should provide message, expected and actual on #failure_message" do
        matcher = equal("1")
        matcher.matches?(1)
        matcher.failure_message_for_should.should == "\nexpected \"1\"\n     got 1\n     \n(compared using equal?)\n"
      end
      
      it "should provide message, expected and actual on #negative_failure_message" do
        matcher = equal(1)
        matcher.matches?(1)
        matcher.failure_message_for_should_not.should == "\nexpected 1 not to equal 1\n\n(compared using equal?)\n"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-1.2.3 spec/spec/matchers/equal_spec.rb
rspec-1.2.4 spec/spec/matchers/equal_spec.rb