/usr/lib/ruby/vendor_ruby/rspec/mocks/any_instance/stub_chain.rb is in ruby-rspec-mocks 3.4.0c3e0m1s1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 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
def invocation_order
@invocation_order ||= {
:with => [nil],
:and_return => [:with, nil],
:and_raise => [:with, nil],
:and_yield => [:with, nil],
:and_call_original => [:with, nil],
:and_wrap_original => [:with, nil]
}
end
def verify_invocation_order(rspec_method_name, *_args, &_block)
return if invocation_order[rspec_method_name].include?(last_message)
raise NoMethodError, "Undefined method #{rspec_method_name}"
end
end
end
end
end
|