class Attestify::Mock::ExpectedCall
Contains a mock's method call expectation.
Public Instance Methods
call(args, block)
click to toggle source
Calls superclass method
Attestify::Mock::CallExpectation#call
# File lib/attestify/mock.rb, line 78 def call(args, block) result = super @caller_locations = caller_locations(2) unless arguments_valid? result end
verify(assertions)
click to toggle source
# File lib/attestify/mock.rb, line 84 def verify(assertions) if !called? assertions.record(false, "Missing expected call to mock: #{self}", caller_locations(4)) elsif !arguments_valid? assertions.record(false, "Expected call to mock: #{self}, but got: #{to_s(:actual)}", @caller_locations) else assertions.record(true) end end
Private Instance Methods
arguments_valid?()
click to toggle source
# File lib/attestify/mock.rb, line 96 def arguments_valid? return false unless args.size == actual_args.size args.each_with_index do |arg, i| return false unless arg === actual_args[i] # rubocop:disable Style/CaseEquality end true end