Sha256: 313656cbbcaa78fde64979c1d561d18399c71eabbc5595b63d5131caa363ed8c

Contents?: true

Size: 942 Bytes

Versions: 24

Compression:

Stored size: 942 Bytes

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.should_receive(:respond_to?).with(:matches?).and_return(true)
        obj.should_receive(: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.should_receive(:respond_to?).with(:matches?).and_return(true)
        obj.should_receive(:respond_to?).with(:description).and_return(false)
        argument_expecatation.is_matcher?(obj).should be_false
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
rspec-mocks-2.0.0 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.0.0.rc spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.0.0.beta.22 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.0.0.beta.20 spec/rspec/mocks/argument_expectation_spec.rb