Class: Lookout::Expectations::Line
- Inherits:
-
Lookout::Expectations
- Object
- Lookout::Expectations
- Lookout::Expectations::Line
- Defined in:
- lib/lookout/expectations/line.rb
Instance Method Summary collapse
- #expect(expected) ⇒ Object
-
#flush ⇒ Object
TODO: It would be great if this method wasn’t necessary.
-
#initialize(line, results = Lookout::Results.new) ⇒ Line
constructor
A new instance of Line.
Methods inherited from Lookout::Expectations
#arg, #mock, #output, #stub, #warning, #without_arguments, #xml
Constructor Details
Instance Method Details
#expect(expected) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/lookout/expectations/line.rb', line 11 def expect(expected) return self if @ran_previous expectation = Lookout::Expectation.on(expected, *Lookout.location(caller.first), &Proc.new) if @previous and @previous.line <= @line and expectation.line > @line flush @previous = nil @ran_previous = true else @previous = expectation end self end |
#flush ⇒ Object
TODO: It would be great if this method wasn’t necessary.
25 26 27 28 |
# File 'lib/lookout/expectations/line.rb', line 25 def flush @results << @previous.evaluate if @previous self end |