Sha256: 5ef7fd0292d7b9539ed63296cedee6517f00215e79025fadca43549916d5af16

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

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"
    subject.should_receive(:===).with("orange").and_return(false)
    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"
    subject.should_receive(:===).with("apple").and_return(true)
    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