lib/mutant/warning_expectation.rb in mutant-0.6.2 vs lib/mutant/warning_expectation.rb in mutant-0.6.3
- old
+ new
@@ -3,20 +3,20 @@
class WarningExpectation
include Adamantium::Flat, Concord.new(:expected)
# Error raised on expectation miss
class ExpectationError < RuntimeError
- include Concord.new(:unexpected)
+ include Concord.new(:unexpected, :expected)
# Return exception message
#
# @return [String]
#
# @api private
#
def message
- "Unexpected warnings: #{unexpected.inspect}"
+ "Unexpected warnings: #{unexpected.inspect}, expected: #{expected.inspect}"
end
end
# Execute blocks with warning expectations
#
@@ -31,10 +31,10 @@
missing = expected - warnings
unexpected = warnings - expected
if unexpected.any?
- fail ExpectationError, unexpected
+ fail ExpectationError.new(unexpected, expected)
end
if missing.any?
$stderr.puts("Expected but missing warnings: #{missing}")
end