Sha256: aea75b070c29e6ecb9e0f28402d8743abf51697d8f4defd381d20c2868f1211a
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' require 'pdksync/logger' RSpec.describe 'logger' do before(:each) do allow(ENV).to receive(:[]).with('PDKSYNC_LOG_FILENAME').and_return('dev/') allow(ENV).to receive(:[]).with('LOG_LEVEL').and_return(nil) # allow(PdkSync::Logger).to receive(:logger).and_return(PdkSync::Logger.logger($stderr)) end let(:logger) do PdkSync::Logger.instance_variable_set('@logger', nil) PdkSync::Logger.logger end it '#self.logger' do expect(PdkSync::Logger.logger).to be_a Logger end it '#self.debug' do allow(ENV).to receive(:[]).with('LOG_LEVEL').and_return('debug') expect(logger.debug('this is a debug')).to be_truthy # wasn't able to capture stdout with rspec, no idea why # expect { logger.debug("this is a debug") }.to output(/DEBUG - PdkSync: this is a debug/).to_stdout end it '#self.warn' do allow(ENV).to receive(:[]).with('LOG_LEVEL').and_return('warn') # wasn't able to capture stdout with rspec, no idea why expect(logger.warn('this is a warning')).to be_truthy # output(/WARN - PdkSync: this is a warning/).to_stdout end it '#self.info' do allow(ENV).to receive(:[]).with('LOG_LEVEL').and_return('info') # wasn't able to capture stdout with rspec, no idea why expect(logger.info('this is a info')).to be_truthy # output(/INFO - PdkSync: this is a info/).to_stderr end it '#self.fatal' do allow(ENV).to receive(:[]).with('LOG_LEVEL').and_return('error') # wasn't able to capture stdout with rspec, no idea why expect(logger.fatal('this is a fatal')).to be_truthy # output(/FATAL - PdkSync: this is a fatal/).to_stderr end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pdksync-0.8.0 | spec/logger_spec.rb |
pdksync-0.6.0 | spec/logger_spec.rb |