Sha256: be91981070f3df8be52f4992d6709be41a935514b16f879a6296d0e465efb994

Contents?: true

Size: 990 Bytes

Versions: 5

Compression:

Stored size: 990 Bytes

Contents

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

require 'spec/expectations/differs/default'

describe "should ==" do
  
  it "should delegate message to target" do
    subject = "apple"
    subject.should_receive(:==).with("apple").and_return(true)
    subject.should == "apple"
  end
  
  it "should fail when target.==(actual) returns false" do
    subject = "apple"
    Spec::Expectations.should_receive(:fail_with).with(%[expected "orange", got "apple" (using ==)], "orange", "apple")
    subject.should == "orange"
  end

end

describe "should_not ==" do
  
  it "should delegate message to target" do
    subject = "orange"
    subject.should_receive(:==).with("apple").and_return(false)
    subject.should_not == "apple"
  end
  
  it "should fail when target.==(actual) returns false" do
    subject = "apple"
    Spec::Expectations.should_receive(:fail_with).with(%[expected not == "apple", got "apple"], "apple", "apple")
    subject.should_not == "apple"
  end

end

  

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rspec-0.9.0 spec/spec/matchers/should_==_spec.rb
rspec-0.9.1 spec/spec/matchers/should_==_spec.rb
rspec-0.9.2 spec/spec/matchers/should_==_spec.rb
rspec-0.9.3 spec/spec/matchers/should_==_spec.rb
rspec-0.9.4 spec/spec/matchers/should_==_spec.rb