Class: Mspec::Expect

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Expect



5
6
7
# File 'lib/m-spec/core/expect.rb', line 5

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#to(matcher) ⇒ Object



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

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

  SpecResult.new(self, matcher, data)
end