Class: Lookout::Expected::Lookout::Warning

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

Overview

Represents expected Warnings.

Instance Method Summary collapse

Instance Method Details

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

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

Parameters:

Returns:



25
26
27
28
# File 'lib/lookout-3.0/expected/lookout/warning.rb', line 25

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

#expect(file, line) { ... } ⇒ Expected::Output

Returns An expect block for the receiver at LINE in FILE that’ll yield and expect the warning to be output to ‘$stderr` during the execution of the block.

Yields:

Yield Returns:

Returns:

  • (Expected::Output)

    An expect block for the receiver at LINE in FILE that’ll yield and expect the warning to be output to ‘$stderr` during the execution of the block



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

def expect(file, line, &block)
  super(file, line){ |expected|
    with_global :$stderr, StringIO.new do
      with_verbose do
        block.call
        expected.class.new($stderr.string)
      end
    end
  }
end