Sha256: a2becf09b9ae6c3a5e02d957cc19b2f53e4cbf206a2adc7e274fa15223d7f2ae
Contents?: true
Size: 1.19 KB
Versions: 55
Compression:
Stored size: 1.19 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 3 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
55 entries across 44 versions & 5 rubygems