Sha256: caf4a393c2dfdb897292408e9011d453c3f51d38d12c3e7e8983a8e708e842d1

Contents?: true

Size: 1.79 KB

Versions: 18

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

module RSpec
  module Mocks
    describe ArgumentExpectation do
      
      it "considers an object that responds to #matches? and #failure_message_for_should to be a matcher" do
        argument_expecatation = RSpec::Mocks::ArgumentExpectation.new
        obj = double("matcher")
        obj.stub(:respond_to?).with(:__rspec_double_acting_as_null_object?).and_return(false)
        obj.stub(:respond_to?).with(:matches?).and_return(true)
        obj.stub(:respond_to?).with(:failure_message_for_should).and_return(true)
        argument_expecatation.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_expecatation = RSpec::Mocks::ArgumentExpectation.new
        obj = double("matcher")
        obj.stub(:respond_to?).with(:__rspec_double_acting_as_null_object?).and_return(false)
        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_expecatation.is_matcher?(obj).should be_true
      end

      it "does NOT consider an object that only responds to #matches? to be a matcher" do
        argument_expecatation = RSpec::Mocks::ArgumentExpectation.new
        obj = double("matcher")
        obj.stub(:respond_to?).with(:__rspec_double_acting_as_null_object?).and_return(false)
        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_expecatation.is_matcher?(obj).should be_false
      end
    end
  end
end

Version data entries

18 entries across 16 versions & 4 rubygems

Version Path
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.8.0/spec/rspec/mocks/argument_expectation_spec.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.8.0/spec/rspec/mocks/argument_expectation_spec.rb
horseman-0.0.4 vendor/ruby/1.9.1/gems/rspec-mocks-2.8.0/spec/rspec/mocks/argument_expectation_spec.rb
horseman-0.0.4 vendor/ruby/1.9.1/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/rspec-mocks-2.8.0/spec/rspec/mocks/argument_expectation_spec.rb
horseman-0.0.2 vendor/ruby/1.9.1/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.8.0 spec/rspec/mocks/argument_expectation_spec.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.8.0.rc2 spec/rspec/mocks/argument_expectation_spec.rb
nutshell-crm-0.0.5 vendor/bundle/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
nutshell-crm-0.0.4 vendor/bundle/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
nutshell-crm-0.0.3 vendor/bundle/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
nutshell-crm-0.0.2 vendor/bundle/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
nutshell-crm-0.0.1 vendor/bundle/gems/rspec-mocks-2.7.0/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.8.0.rc1 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.7.0 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.7.0.rc1 spec/rspec/mocks/argument_expectation_spec.rb