Sha256: 5321996da7b954e075d1bf111608ceb331e678b6f0703701d758c43cc9cad1ca

Contents?: true

Size: 1.25 KB

Versions: 8

Compression:

Stored size: 1.25 KB

Contents

module RSpec
  module Mocks
    module AnyInstance
      # @private
      class ExpectationChain < Chain
        def expectation_fulfilled?
          @expectation_fulfilled || constrained_to_any_of?(:never, :any_number_of_times)
        end

        def initialize(*args, &block)
          @expectation_fulfilled = false
          super
        end

      private

        def verify_invocation_order(rspec_method_name, *args, &block)
        end
      end

      # @private
      class PositiveExpectationChain < ExpectationChain

      private

        def create_message_expectation_on(instance)
          proxy = ::RSpec::Mocks.space.proxy_for(instance)
          method_name, opts = @expectation_args
          opts = (opts || {}).merge(:expected_form => IGNORED_BACKTRACE_LINE)

          me = proxy.add_message_expectation(method_name, opts, &@expectation_block)
          if RSpec::Mocks.configuration.yield_receiver_to_any_instance_implementation_blocks?
            me.and_yield_receiver_to_implementation
          end

          me
        end

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rspec-mocks-3.0.4 lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-3.0.3 lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-3.0.2 lib/rspec/mocks/any_instance/expectation_chain.rb
whos_dated_who-0.1.0 vendor/bundle/gems/rspec-mocks-3.0.1/lib/rspec/mocks/any_instance/expectation_chain.rb
whos_dated_who-0.0.1 vendor/bundle/gems/rspec-mocks-3.0.1/lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-3.0.1 lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-3.0.0 lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-3.0.0.rc1 lib/rspec/mocks/any_instance/expectation_chain.rb