Sha256: 608562211c279fffff1c056b3dbb07b5ee8ffab8febdabfe247145e5f76af6ec
Contents?: true
Size: 962 Bytes
Versions: 2
Compression:
Stored size: 962 Bytes
Contents
module RSpec module LoggingHelper # Capture log messages from the Logging framework and make them # available via a @log_output instance variable. The @log_output # supports a readline method to access the log messags. # def capture_log_messages( opts = {} ) from = opts.getopt(:from, 'root') to = opts.getopt(:to, '__rspec__') exclusive = opts.getopt(:exclusive, true) appender = Logging::Appenders[to] || Logging::Appenders::StringIo.new(to) logger = Logging::Logger[from] if exclusive logger.appenders = appender else logger.add_appenders(appender) end before(:all) do @log_output = Logging::Appenders[to] end before(:each) do @log_output.reset end end end # module LoggingHelper end # module RSpec if defined? RSpec::Core::Configuration class RSpec::Core::Configuration include RSpec::LoggingHelper end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
logging-1.6.1 | lib/rspec/logging_helper.rb |
logging-1.6.0 | lib/rspec/logging_helper.rb |