Skip to content
Browse files

Add tests to demonstrate using a block as a custom parameter matcher.

Relates to #80.
  • Loading branch information...
1 parent 57046a4 commit 4bed68a18cbbe9be59cf16fd94d654ec15b083de @floehopper floehopper committed May 14, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/acceptance/parameter_matcher_test.rb
View
17 test/acceptance/parameter_matcher_test.rb
@@ -297,4 +297,21 @@ def test_should_match_parameter_with_no_domain_or_scheme
assert_passed(test_result)
end
+ def test_should_match_parameter_when_block_returns_true
+ test_result = run_as_test do
+ mock = mock()
+ mock.expects(:method).with { |actual_value| actual_value % 4 == 0 }
+ mock.method(8)
+ end
+ assert_passed(test_result)
+ end
+
+ def test_should_not_match_parameter_when_block_returns_false
+ test_result = run_as_test do
+ mock = mock()
+ mock.expects(:method).with { |actual_value| actual_value % 4 == 0 }
+ mock.method(9)
+ end
+ assert_failed(test_result)
+ end
end

0 comments on commit 4bed68a

Please sign in to comment.
Something went wrong with that request. Please try again.