Class: Lookout::Expectations::Behavior

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

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



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lookout/expectations/behavior.rb', line 6

def evaluate_with_stubs
  Lookout::Mock.methods do |mocks|
    @expected.subject! mocks, @stubs
    instance_exec @expected.subject, &@block if @block
    @expected.verify
  end
  Lookout::Results::Fulfilled.new(file, line)
rescue Lookout::Recorders::State::Error => e
  Lookout::Results::Failures::State.new(file, line, e.message)
rescue Lookout::Mock::Error => e
  Lookout::Results::Failures::Behavior.new(file, line, e.message)
rescue Exception => e
  Lookout::Results::Error.new(file, line, nil, e)
end