Sha256: 56d7c5df7f1b47e9a74c03fbae5dfc8b2a8aa24b80211c233b8f1c419b7561a1

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

module RSpec
  module Mocks
    describe ArgumentExpectation do
      it "considers an object that responds to #matches? and #description 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(:description).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(:description).and_return(false)
        argument_expecatation.is_matcher?(obj).should be_false
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rspec-mocks-2.5.0/spec/rspec/mocks/argument_expectation_spec.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rspec-mocks-2.5.0/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.6.0 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.6.0.rc6 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.6.0.rc4 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.6.0.rc2 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.5.0 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.4.0 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.3.0 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.2.0 spec/rspec/mocks/argument_expectation_spec.rb