Class: Lookout::Expected::Lookout::Warning
- Defined in:
- lib/lookout-3.0/expected/lookout/warning.rb
Overview
Represents expected Warnings.
Instance Method Summary collapse
-
#difference(actual) ⇒ Difference::Lookout::Warning?
A difference report between ACTUAL and #expected unless they’re ‘#===`.
-
#expect(file, line) { ... } ⇒ 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.
Instance Method Details
#difference(actual) ⇒ Difference::Lookout::Warning?
Returns A difference report between ACTUAL and #expected unless they’re ‘#===`.
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.
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 |