File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -271,6 +271,22 @@ def at_most_once
271
271
# object.expects(:expected_method).with() { |value| value % 4 == 0 }
272
272
# object.expected_method(17)
273
273
# # => verify fails
274
+ #
275
+ # @example Extracting a custom matcher into an instance method on the test class.
276
+ # class MyTest < Minitest::Test
277
+ # def test_expected_method_is_called_with_a_value_divisible_by_4
278
+ # object = mock()
279
+ # object.expects(:expected_method).with(&method(:divisible_by_4))
280
+ # object.expected_method(16)
281
+ # # => verify succeeds
282
+ # end
283
+ #
284
+ # private
285
+ #
286
+ # def divisible_by_4(value)
287
+ # value % 4 == 0
288
+ # end
289
+ # end
274
290
def with ( *expected_parameters_or_matchers , &matching_block )
275
291
@parameters_matcher = ParametersMatcher . new ( expected_parameters_or_matchers , self , &matching_block )
276
292
self
You can’t perform that action at this time.
0 commit comments