Sha256: 00807eddb92feb3c1ab81712fd48c561fce82e9232afbe32c222b3a44e44481d

Contents?: true

Size: 1.5 KB

Versions: 122

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

module RSpec
  module Mocks
    describe ArgumentExpectation do

      it "considers an object that responds to #matches? and #failure_message_for_should to be a matcher" do
        argument_expecatation = RSpec::Mocks::ArgumentExpectation.new
        obj = double("matcher")
        obj.stub(:respond_to?).with(:matches?).and_return(true)
        obj.stub(:respond_to?).with(:failure_message_for_should).and_return(true)
        argument_expecatation.is_matcher?(obj).should be_true
      end

      it "considers an object that responds to #matches? and #failure_message to be a matcher for backward compatibility" do
        argument_expecatation = RSpec::Mocks::ArgumentExpectation.new
        obj = double("matcher")
        obj.stub(:respond_to?).with(:matches?).and_return(true)
        obj.stub(:respond_to?).with(:failure_message_for_should).and_return(false)
        obj.stub(:respond_to?).with(:failure_message).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(:matches?).and_return(true)
        obj.stub(:respond_to?).with(:failure_message_for_should).and_return(false)
        obj.stub(:respond_to?).with(:failure_message).and_return(false)
        argument_expecatation.is_matcher?(obj).should be_false
      end
    end
  end
end

Version data entries

122 entries across 71 versions & 9 rubygems

Version Path
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rails-uploader-0.0.1/vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/spec/rspec/mocks/argument_expectation_spec.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/spec/rspec/mocks/argument_expectation_spec.rb
rails-uploader-0.0.1 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.10.1/spec/rspec/mocks/argument_expectation_spec.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
ftl-0.2.0 vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/argument_expectation_spec.rb
classiccms-0.2.4.pre vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
classiccms-0.2.4.pre vendor/bundle/gems/rspec-mocks-2.10.1/spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.10.1 spec/rspec/mocks/argument_expectation_spec.rb
rspec-mocks-2.10.0 spec/rspec/mocks/argument_expectation_spec.rb
horseman-0.0.5 vendor/ruby/1.9.1/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
classicCMS-0.2.3 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
classicCMS-0.2.2 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
classicCMS-0.2.1 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
classicCMS-0.2.0 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb
classicCMS-0.1.2 vendor/bundle/gems/rspec-mocks-2.9.0/spec/rspec/mocks/argument_expectation_spec.rb