Class: Mspec::Expect

Inherits:
Object
  • Object
show all
Defined in:
lib/m-spec/core/expect.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Expect

Returns a new instance of Expect.



3
4
5
# File 'lib/m-spec/core/expect.rb', line 3

def initialize(value)
  @value = value
end

Instance Method Details

#to(matcher) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/m-spec/core/expect.rb', line 7

def to(matcher)
  begin
    raise SpecError.new unless matcher.check(@value)
  rescue SpecError => e
    data = e
  end

  SpecResult.new(data)
end