Class: Lookout::Expected::Lookout::Output

Inherits:
Object show all
Defined in:
lib/lookout-3.0/expected/lookout/output.rb

Overview

Represents expected Outputs.

Instance Method Summary collapse

Instance Method Details

#difference(actual) ⇒ Difference::Lookout::Output?

Returns A difference report between ACTUAL and #expected unless they’re ‘#==`.

Parameters:

Returns:



22
23
24
25
# File 'lib/lookout-3.0/expected/lookout/output.rb', line 22

def difference(actual)
  Lookout::Difference::Lookout::Output.new(actual, expected) unless
    expected == actual
end

#expect(file, line) {|io| ... } ⇒ Expect::Lookout::Output

Returns An expect block for the receiver at LINE in FILE that’ll yield an IO object that’ll expect to see the #expected output during the execution of the block.

Yield Parameters:

  • io (::IO)

Yield Returns:

Returns:

  • (Expect::Lookout::Output)

    An expect block for the receiver at LINE in FILE that’ll yield an IO object that’ll expect to see the #expected output during the execution of the block



11
12
13
14
15
16
17
# File 'lib/lookout-3.0/expected/lookout/output.rb', line 11

def expect(file, line, &block)
  super(file, line){ |expected|
    output = StringIO.new
    block.call output
    expected.class.new(output.string)
  }
end