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 'Miss'

Defined Under Namespace

Classes: Miss

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Expectation

Returns a new instance of Expectation.



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

def initialize(value)
  @value = value
end

Instance Method Details

#to(matcher) ⇒ Object

Raises:



21
22
23
# File 'lib/specifier/expectation.rb', line 21

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