Sha256: 3f051eb1bd5a5f44f6af8ab08ac4186e66c49301ed45fc29bcb734a696a2cc90
Contents?: true
Size: 1007 Bytes
Versions: 4
Compression:
Stored size: 1007 Bytes
Contents
module Mutant # A class to expect some warning message raising on absence of unexpected warnings class WarningExpectation include Adamantium::Flat, Concord.new(:expected) # Error raised on expectation miss class ExpectationError < RuntimeError include Concord.new(:unexpected) # Return exception message # # @return [String] # # @api private # def message "Unexpected warnings: #{unexpected.inspect}" end end # Execute blocks with warning expectations # # @return [self] # # @api private # def execute(&block) warnings = WarningFilter.use do block.call end missing = expected - warnings unexpected = warnings - expected if unexpected.any? fail ExpectationError, unexpected end if missing.any? $stderr.puts("Expected but missing warnings: #{missing}") end self end end # WarningExpectation end # Mutant
Version data entries
4 entries across 4 versions & 1 rubygems