Class: Specifier::Expectation

Inherits:
Object
  • Object
show all
Defined in:
lib/specifier/expectation.rb

Overview

Configures an expectation (used for expect statements).

Usage:

expectation = Specifier::Expectation.new("today")
expectation.to(matcher) # 'raises 'ToError'

Defined Under Namespace

Classes: MatcherError

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Expectation

Returns a new instance of Expectation.



13
14
15
# File 'lib/specifier/expectation.rb', line 13

def initialize(value)
  @value = value
end

Instance Method Details

#to(matcher) ⇒ Object

Raises:



17
18
19
# File 'lib/specifier/expectation.rb', line 17

def to(matcher)
  raise MatcherError, matcher.message unless matcher.match?(@value)
end