Sha256: 1cfc15c68d37b1e8f9c50eb6077a119b4d76e6714cba56e943fc6bc2e558ce72
Contents?: true
Size: 962 Bytes
Versions: 1
Compression:
Stored size: 962 Bytes
Contents
require_relative '../spec_helper' require 'hawkular/logger' describe Hawkular::Logger do let(:file) { Tempfile.new('hawkular_spec') } subject(:logger) { described_class.new(file) } describe '#log' do before { allow(Hawkular::EnvConfig).to receive(:log_response?) { true } } it 'logs the message to a file' do logger.log('this is a message') file.flush expect(File.read(file)).to include 'this is a message' end it 'does not log anything if the config does not allow it' do allow(Hawkular::EnvConfig).to receive(:log_response?) { false } logger.log('this is a message') file.flush expect(File.read(file)).to be_empty end %w(debug info warn error fatal).each do |priority| it "allows to log with #{priority} priority" do logger.log('this is a message', priority) file.flush expect(File.read(file)).to include priority.upcase end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hawkular-client-2.9.0 | spec/integration/logger_spec.rb |