Sha256: a44510525cdd5c2a4f3b6c34dc163a57b94316ac6001db24ea49a865ed8d5048

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

module RSpec
  module Mocks
    describe ArgumentListMatcher do
      let(:argument_expectation) { RSpec::Mocks::ArgumentListMatcher.new }
      let(:obj) { double("matcher") }

      it "considers an object that responds to #matches? and #failure_message_for_should to be a matcher" do
        obj.stub(:matches?)
        obj.stub(:failure_message_for_should)
        expect(argument_expectation.send(:is_matcher?, obj)).to be true
      end

      it "considers an object that responds to #matches? and #failure_message to be a matcher for backward compatibility" do
        obj.stub(:matches?)
        obj.stub(:failure_message)
        expect(argument_expectation.send(:is_matcher?, obj)).to be true
      end

      it "does NOT consider an object that only responds to #matches? to be a matcher" do
        obj.stub(:matches?)
        expect(argument_expectation.send(:is_matcher?, obj)).to be false
      end

      it "does not consider a null object to be a matcher" do
        obj.as_null_object
        expect(argument_expectation.send(:is_matcher?, obj)).to be false
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rspec-mocks-2.99.4 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.99.3 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.99.2 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.99.1 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.99.0 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.99.0.rc1 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.99.0.beta2 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.99.0.beta1 spec/rspec/mocks/argument_expectation_spec.rb