Sha256: 73a724eb7b7fb2341981949ef0e6d868634ecdc7ad8ffb2426dbc797763d9363

Contents?: true

Size: 1.1 KB

Versions: 30

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

30 entries across 30 versions & 8 rubygems

Version Path
dxruby_rp5-0.0.1 spec/vendor/rspec-mocks-2.14.4/spec/rspec/mocks/argument_expectation_spec.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/rspec-mocks-2.14.4/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.14.4 spec/rspec/mocks/argument_expectation_spec.rb
clickable_link-0.0.2 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.14.3/spec/rspec/mocks/argument_expectation_spec.rb
syllable_counter-1.0.0 vendor/bundle/gems/rspec-mocks-2.14.3/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.14.3 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.14.2 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.14.1 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.14.0 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.14.0.rc1 spec/rspec/mocks/argument_expectation_spec.rb