Sha256: 751641ff48114576f94f5a2d1640f2d358da12b0c55557c8452f7070c1008759

Contents?: true

Size: 963 Bytes

Versions: 11

Compression:

Stored size: 963 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 messages.
    #
    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

11 entries across 11 versions & 4 rubygems

Version Path
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/logging-1.8.2/lib/rspec/logging_helper.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/logging-1.8.2/lib/rspec/logging_helper.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/logging-1.8.2/lib/rspec/logging_helper.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/logging-1.8.1/lib/rspec/logging_helper.rb
logging-1.8.2 lib/rspec/logging_helper.rb
logging-1.8.1 lib/rspec/logging_helper.rb
logging-1.8.0 lib/rspec/logging_helper.rb
logging-1.7.2 lib/rspec/logging_helper.rb
logging-1.7.1 lib/rspec/logging_helper.rb
logging-1.7.0 lib/rspec/logging_helper.rb
logging-1.6.2 lib/rspec/logging_helper.rb