Sha256: b1fadf480e26697361c6830b715cda619f9681ec085b28a1ba10888dcb41093f
Contents?: true
Size: 1.18 KB
Versions: 42
Compression:
Stored size: 1.18 KB
Contents
require 'mocha/parameter_matchers/base' module Mocha module ParameterMatchers # Matches any +Object+ equalling +value+. # # @param [Object] value expected value. # @return [Equals] parameter matcher. # # @see Expectation#with # @see Object#== # # @example Actual parameter equals expected parameter. # object = mock() # object.expects(:method_1).with(equals(2)) # object.method_1(2) # # no error raised # # @example Actual parameter does not equal expected parameter. # object = mock() # object.expects(:method_1).with(equals(2)) # object.method_1(3) # # error raised, because method_1 was not called with an +Object+ that equals 2 def equals(value) Equals.new(value) end # Parameter matcher which matches when actual parameter equals expected value. class Equals < Base # @private def initialize(value) @value = value end # @private def matches?(available_parameters) parameter = available_parameters.shift parameter == @value end # @private def mocha_inspect @value.mocha_inspect end end end end
Version data entries
42 entries across 42 versions & 4 rubygems