Sha256: aab929341d0192345face932299c25f88c7395cd1cf0844e5921f6283594709c

Contents?: true

Size: 1004 Bytes

Versions: 6

Compression:

Stored size: 1004 Bytes

Contents

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

        # @private
        def expectation_fulfilled?
          true
        end

        private

        def create_message_expectation_on(instance)
          proxy = ::RSpec::Mocks.proxy_for(instance)
          expected_from = IGNORED_BACKTRACE_LINE
          proxy.add_stub(expected_from, *@expectation_args, &@expectation_block)
        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

6 entries across 6 versions & 3 rubygems

Version Path
clickable_link-0.0.2 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.14.3/lib/rspec/mocks/any_instance/stub_chain.rb
syllable_counter-1.0.0 vendor/bundle/gems/rspec-mocks-2.14.3/lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.14.3 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.14.2 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.14.1 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.14.0 lib/rspec/mocks/any_instance/stub_chain.rb