Sha256: 353e96161fa4fad670589123a547ed3df19bfb5e23097d7443ce8754d2a46640

Contents?: true

Size: 958 Bytes

Versions: 4

Compression:

Stored size: 958 Bytes

Contents

require 'spec_helper'

module Rspec
  module Mocks
    describe ArgumentExpectation do
      it "should consider 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 "should 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

4 entries across 4 versions & 1 rubygems

Version Path
rspec-mocks-2.0.0.beta.8 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.0.0.beta.7 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.0.0.beta.6 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.0.0.beta.5 spec/rspec/mocks/argument_expectation_spec.rb