Class: Smartest::ExpectationTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/smartest/expectation_target.rb

Instance Method Summary collapse

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

Raises:



15
16
17
18
19
# File 'lib/smartest/expectation_target.rb', line 15

def not_to(matcher)
  return self unless matcher.matches?(@actual)

  raise AssertionFailed, matcher.negated_failure_message
end

#to(matcher) ⇒ Object

Raises:



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.failure_message
end