Class: Mocktail::RaisesVerificationError
- Inherits:
-
Object
- Object
- Mocktail::RaisesVerificationError
- Extended by:
- T::Sig
- Defined in:
- lib/mocktail/verifies_call/raises_verification_error.rb,
lib/mocktail/sorbet/mocktail/verifies_call/raises_verification_error.rb
Instance Method Summary collapse
-
#initialize ⇒ RaisesVerificationError
constructor
A new instance of RaisesVerificationError.
- #raise(recording, verifiable_calls, demo_config) ⇒ Object
Constructor Details
#initialize ⇒ RaisesVerificationError
Returns a new instance of RaisesVerificationError.
9 10 11 12 13 |
# File 'lib/mocktail/verifies_call/raises_verification_error.rb', line 9 def initialize @gathers_calls_of_method = GathersCallsOfMethod.new @stringifies_method_name = StringifiesMethodName.new @stringifies_call = StringifiesCall.new end |
Instance Method Details
#raise(recording, verifiable_calls, demo_config) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mocktail/verifies_call/raises_verification_error.rb', line 15 def raise(recording, verifiable_calls, demo_config) Kernel.raise VerificationError.new <<~MSG Expected mocktail of `#{@stringifies_method_name.stringify(recording)}' to be called like: #{@stringifies_call.stringify(recording)}#{[ (" [#{demo_config.times} #{pl("time", demo_config.times)}]" unless demo_config.times.nil?), (" [ignoring extra args]" if demo_config.ignore_extra_args), (" [ignoring blocks]" if demo_config.ignore_block) ].compact.join(" ")} #{[ describe_verifiable_times_called(demo_config, verifiable_calls.size), describe_other_calls(recording, verifiable_calls, demo_config) ].compact.join("\n\n")} MSG end |