Sha256: 2be8d3cf69fa7ec0535bdd8592822f3fd0cb8deefde98ec79d6d18af940d29b3

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

module RSpec
  module Mocks
    module AnyInstance
      # @private
      class StubChain < Chain

        # @private
        def expectation_fulfilled?
          true
        end

        private

        def create_message_expectation_on(instance)
          super do |proxy, expected_from|
            stub = proxy.add_stub(expected_from, *@expectation_args, &@expectation_block)
            @recorder.stubs[stub.message] << stub
            stub
          end
        end

        def invocation_order
          @invocation_order ||= {
            :with => [nil],
            :and_return => [:with, nil],
            :and_raise => [:with, nil],
            :and_yield => [:with, nil],
            :and_call_original => [:with, nil]
          }
        end

        def verify_invocation_order(rspec_method_name, *args, &block)
          unless invocation_order[rspec_method_name].include?(last_message)
            raise(NoMethodError, "Undefined method #{rspec_method_name}")
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rspec-mocks-2.99.4 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.99.3 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.99.2 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.99.1 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.99.0 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.99.0.rc1 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.99.0.beta2 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.99.0.beta1 lib/rspec/mocks/any_instance/stub_chain.rb