Sha256: 3e0b877999d076c3df9685eb3d9d8a4ebf89d874275f3801c3bc96f94ca4fcd3

Contents?: true

Size: 1.42 KB

Versions: 6903

Compression:

Stored size: 1.42 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)
          proxy = ::RSpec::Mocks.space.proxy_for(instance)
          method_name, opts = @expectation_args
          opts = (opts || {}).merge(:expected_form => IGNORED_BACKTRACE_LINE)

          stub = proxy.add_stub(method_name, opts, &@expectation_block)
          @recorder.stubs[stub.message] << stub

          if RSpec::Mocks.configuration.yield_receiver_to_any_instance_implementation_blocks?
            stub.and_yield_receiver_to_implementation
          end

          stub
        end

        InvocationOrder =
          {
            :and_return => [:with, nil],
            :and_raise => [:with, nil],
            :and_yield => [:with, :and_yield, nil],
            :and_throw => [:with, nil],
            :and_call_original => [:with, nil],
            :and_wrap_original => [:with, nil]
          }.freeze

        EmptyInvocationOrder = {}.freeze

        def invocation_order
          InvocationOrder
        end

        def verify_invocation_order(rspec_method_name, *_args, &_block)
          return if invocation_order.fetch(rspec_method_name, [nil]).include?(last_message)
          raise NoMethodError, "Undefined method #{rspec_method_name}"
        end
      end
    end
  end
end

Version data entries

6,903 entries across 6,834 versions & 85 rubygems

Version Path
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/rspec-mocks-3.11.1/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_bank_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_organization_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_id_ruby-0.123.12 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_bank_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_organization_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_id_ruby-0.123.11 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_id_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_bank_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_organization_ruby-0.123.10 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_organization_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_id_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_bank_ruby-0.123.7 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
ory-client-1.15.12 vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_bank_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_id_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_organization_ruby-0.123.4 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_bank_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_organization_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb
cybrid_api_id_ruby-0.123.3 vendor/bundle/ruby/3.3.0/gems/rspec-mocks-3.13.2/lib/rspec/mocks/any_instance/stub_chain.rb