Class: RSpec::Mocks::VerifyingMethodDouble
- Inherits:
-
MethodDouble
show all
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_proxy.rb
Constant Summary
Constants inherited
from MethodDouble
MethodDouble::FROZEN_ERROR_MSG
Instance Attribute Summary
Attributes inherited from MethodDouble
#expectations, #method_name, #method_stasher, #object, #stubs
Instance Method Summary
collapse
#add_default_stub, #add_simple_expectation, #add_simple_stub, #build_expectation, #clear, #configure_method, #define_proxy_method, #object_singleton_class, #original_implementation_callable, #original_method, #raise_method_not_stubbed_error, #remove_stub, #remove_stub_if_present, #reset, #restore_original_method, #restore_original_visibility, #setup_simple_method_double, #show_frozen_warning, #verify, #visibility
Constructor Details
#initialize(object, method_name, proxy, method_reference) ⇒ VerifyingMethodDouble
Returns a new instance of VerifyingMethodDouble.
140
141
142
143
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_proxy.rb', line 140
def initialize(object, method_name, proxy, method_reference)
super(object, method_name, proxy)
@method_reference = method_reference
end
|
Instance Method Details
#add_expectation(*args, &block) ⇒ Object
149
150
151
152
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_proxy.rb', line 149
def add_expectation(*args, &block)
super(*args, &block).tap { |x| x.method_reference = @method_reference }
end
|
#add_stub(*args, &block) ⇒ Object
154
155
156
157
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_proxy.rb', line 154
def add_stub(*args, &block)
super(*args, &block).tap { |x| x.method_reference = @method_reference }
end
|
#message_expectation_class ⇒ Object
145
146
147
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_proxy.rb', line 145
def message_expectation_class
VerifyingMessageExpectation
end
|
#proxy_method_invoked(obj, *args, &block) ⇒ Object
159
160
161
162
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_proxy.rb', line 159
def proxy_method_invoked(obj, *args, &block)
validate_arguments!(args)
super
end
|
#validate_arguments!(actual_args) ⇒ Object
165
166
167
168
169
170
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rspec-mocks-3.12.2/lib/rspec/mocks/verifying_proxy.rb', line 165
def validate_arguments!(actual_args)
@method_reference.with_signature do |signature|
verifier = Support::StrictSignatureVerifier.new(signature, actual_args)
raise ArgumentError, verifier.error_message unless verifier.valid?
end
end
|