Sha256: f2063d1184eb0d5b323f8a693a3fada9334da0b26da8d6b6a71534dc8601cd3d

Contents?: true

Size: 1.52 KB

Versions: 12

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'

module RSpec
  module Mocks
    describe ArgumentListMatcher do

      it "considers an object that responds to #matches? and #failure_message_for_should to be a matcher" do
        argument_expectation = RSpec::Mocks::ArgumentListMatcher.new
        obj = double("matcher")
        obj.stub(:respond_to?).with(:matches?).and_return(true)
        obj.stub(:respond_to?).with(:failure_message_for_should).and_return(true)
        argument_expectation.send(:is_matcher?, obj).should be_true
      end

      it "considers an object that responds to #matches? and #failure_message to be a matcher for backward compatibility" do
        argument_expectation = RSpec::Mocks::ArgumentListMatcher.new
        obj = double("matcher")
        obj.stub(:respond_to?).with(:matches?).and_return(true)
        obj.stub(:respond_to?).with(:failure_message_for_should).and_return(false)
        obj.stub(:respond_to?).with(:failure_message).and_return(true)
        argument_expectation.send(:is_matcher?, obj).should be_true
      end

      it "does NOT consider an object that only responds to #matches? to be a matcher" do
        argument_expectation = RSpec::Mocks::ArgumentListMatcher.new
        obj = double("matcher")
        obj.stub(:respond_to?).with(:matches?).and_return(true)
        obj.stub(:respond_to?).with(:failure_message_for_should).and_return(false)
        obj.stub(:respond_to?).with(:failure_message).and_return(false)
        argument_expectation.send(:is_matcher?, obj).should be_false
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 5 rubygems

Version Path
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/spec/rspec/mocks/argument_expectation_spec.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.12.1 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.12.0 spec/rspec/mocks/argument_expectation_spec.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/spec/rspec/mocks/argument_expectation_spec.rb
gem_repackager-0.1.0 support/gems/rspec-mocks-2.11.1/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.11.3 spec/rspec/mocks/argument_expectation_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/rspec-mocks-2.11.1/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.11.2 spec/rspec/mocks/argument_expectation_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/rspec-mocks-2.11.1/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.11.1 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.11.0 spec/rspec/mocks/argument_expectation_spec.rb