Sha256: a560da7b21a622635a13c6675dd645b51221d8d61fecc58d5492c6f2045c96de
Contents?: true
Size: 1.17 KB
Versions: 15
Compression:
Stored size: 1.17 KB
Contents
require 'spec_helper' require 'mail_room/delivery/logger' describe MailRoom::Delivery::Logger do describe '#initialize' do context "without a log path" do let(:mailbox) {MailRoom::Mailbox.new} it 'creates a new ruby logger' do ::Logger.stubs(:new) MailRoom::Delivery::Logger.new(mailbox) ::Logger.should have_received(:new).with(STDOUT) end end context "with a log path" do let(:mailbox) {MailRoom::Mailbox.new(:log_path => '/var/log/mail-room.log')} it 'creates a new file to append to' do ::Logger.stubs(:new) file = stub(:sync=) ::File.stubs(:open).returns(file) MailRoom::Delivery::Logger.new(mailbox) File.should have_received(:open).with('/var/log/mail-room.log', 'a') ::Logger.should have_received(:new).with(file) end end end describe '#deliver' do let(:mailbox) {MailRoom::Mailbox.new} it 'writes the message to info' do logger = stub(:info) ::Logger.stubs(:new).returns(logger) MailRoom::Delivery::Logger.new(mailbox).deliver('a message') logger.should have_received(:info).with('a message') end end end
Version data entries
15 entries across 15 versions & 1 rubygems