Sha256: add7bc337520871bd6fc4485beee0da5767c92c8acafdcb32b01e2e61e0071c3

Contents?: true

Size: 625 Bytes

Versions: 13

Compression:

Stored size: 625 Bytes

Contents

# A shared context that allows you to check the output of Hashie's logger.
#
# @example
#   include_context 'with a logger'
#
#   it 'logs info message' do
#     Hashie.logger.info 'What is happening in here?!'
#
#     expect(logger_output).to match('What is happening in here?!')
#   end
RSpec.shared_context 'with a logger' do
  # @private
  let(:log) { StringIO.new }

  # The output string from the logger
  let(:logger_output) { log.rewind && log.string }

  around(:each) do |example|
    original_logger = Hashie.logger
    Hashie.logger = Logger.new(log)
    example.run
    Hashie.logger = original_logger
  end
end

Version data entries

13 entries across 12 versions & 3 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/hashie-3.6.0/spec/support/logger.rb
hashie-4.0.0 spec/support/logger.rb
hashie-3.6.0 spec/support/logger.rb
tdiary-5.0.8 vendor/bundle/gems/hashie-3.5.7/spec/support/logger.rb
hashie-3.5.7 spec/support/logger.rb
hashie-3.5.6 spec/support/logger.rb
tdiary-5.0.5 vendor/bundle/gems/hashie-3.5.5/spec/support/logger.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/hashie-3.5.5/spec/support/logger.rb
tdiary-5.0.4 vendor/bundle/gems/hashie-3.5.5/spec/support/logger.rb
hashie-3.5.5 spec/support/logger.rb
hashie-3.5.4 spec/support/logger.rb
hashie-3.5.3 spec/support/logger.rb
hashie-3.5.2 spec/support/logger.rb