Module: Matchy::Assertions
- Defined in:
- lib/matchy/assertions.rb
Instance Method Summary collapse
-
#assert_accepts(matcher, target) ⇒ Object
Asserts that the given matcher returns true when
target
is passed to #matches?. -
#assert_rejects(matcher, target) ⇒ Object
Asserts that the given matcher returns false when
target
is passed to #matches?.
Instance Method Details
#assert_accepts(matcher, target) ⇒ Object
Asserts that the given matcher returns true when target
is passed to #matches?
4 5 6 7 |
# File 'lib/matchy/assertions.rb', line 4 def assert_accepts(matcher, target) success = matcher.matches?(target) assert_block(matcher.) { success } end |
#assert_rejects(matcher, target) ⇒ Object
Asserts that the given matcher returns false when target
is passed to #matches?
10 11 12 13 |
# File 'lib/matchy/assertions.rb', line 10 def assert_rejects(matcher, target) success = !matcher.matches?(target) assert_block(matcher.) { success } end |