Class: Smartest::ExpectationTarget
- Inherits:
-
Object
- Object
- Smartest::ExpectationTarget
- Defined in:
- lib/smartest/expectation_target.rb
Instance Method Summary collapse
-
#initialize(actual) ⇒ ExpectationTarget
constructor
A new instance of ExpectationTarget.
- #not_to(matcher) ⇒ Object
- #to(matcher) ⇒ Object
Constructor Details
#initialize(actual) ⇒ ExpectationTarget
Returns a new instance of ExpectationTarget.
5 6 7 |
# File 'lib/smartest/expectation_target.rb', line 5 def initialize(actual) @actual = actual end |
Instance Method Details
#not_to(matcher) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/smartest/expectation_target.rb', line 15 def not_to(matcher) if matcher.respond_to?(:does_not_match?) return self if matcher.does_not_match?(@actual) raise AssertionFailed, matcher. end return self unless matcher.matches?(@actual) raise AssertionFailed, matcher. end |
#to(matcher) ⇒ Object
9 10 11 12 13 |
# File 'lib/smartest/expectation_target.rb', line 9 def to(matcher) return self if matcher.matches?(@actual) raise AssertionFailed, matcher. end |