Class: Lookout::Expectations::State

Inherits:
Object
  • Object
show all
Includes:
Lookout::Expectation
Defined in:
lib/lookout/expectations/state.rb

Direct Known Subclasses

Warning

Defined Under Namespace

Classes: Warning

Instance Attribute Summary

Attributes included from Lookout::Expectation

#file, #line

Instance Method Summary collapse

Methods included from Lookout::Expectation

#evaluate, #initialize, on, #stub, #with_verbose

Instance Method Details

#evaluate_with_stubsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lookout/expectations/state.rb', line 8

def evaluate_with_stubs
  check(@block ? instance_exec(@expected, &@block) : false)
rescue Exception => e
  return check(e) if StandardError === @expected and @expected.class == e.class
  return Lookout::Results::Fulfilled.new(file, line) if @expected.eql? e.class
  Lookout::Results::Error.new(file, line,
    if Class === @expected and StandardError >= @expected
      Lookout::Equality.message(@expected, e.class)
    elsif StandardError === @expected
      Lookout::Equality.message(@expected.class, e.class)
    else
      nil
    end,
    e)
end