Sha256: 63ab590f573d419b3c5436fbd5a62f40635125c82c7a9f0d7b0b2f7aa243af46
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require 'spec_helper' describe Pairzone::Logger do let(:stdout) { mock } let(:stderr) { mock } it "works without first configuring" do ->{ Pairzone::Logger.info("foo") }.should_not raise_error end context "after configuration" do before do Pairzone::Logger.instance_variable_set(:@stdout, stdout) Pairzone::Logger.instance_variable_set(:@stderr, stderr) end it 'prints output to standard output' do msg = 'foo' stdout.should_receive(:say).with(msg) Pairzone::Logger.info(msg) end it 'prints debug messages to std error with a prefix' do Pairzone::Logger.instance_variable_set(:@level, true) stderr.should_receive(:say).with(/debug.*foo/) Pairzone::Logger.debug('foo') end it 'does not print debug messages if they are not turned on' do Pairzone::Logger.instance_variable_set(:@level, false) stderr.should_not_receive(:say).with(/debug.*foo/) Pairzone::Logger.debug('foo') end it 'prints error messages to std output' do msg = 'foo' stdout.should_receive(:say).with(/error.*foo/) Pairzone::Logger.error(msg) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pairzone-0.0.1 | spec/pairzone/logger_spec.rb |