Sha256: f96b5c4c3ad938ab063402202d0a47fabfcd1e2cbe3af0f70b1b77a6c400fbbb
Contents?: true
Size: 1.16 KB
Versions: 4
Compression:
Stored size: 1.16 KB
Contents
require 'spec_helper' require 'crash_log/rails' describe "Initializer" do let(:logger) { stub("Logger") } let(:other_logger) { stub("OtherLogger") } let(:rails) { double('Rails') } before(:each) do define_constant('Rails', rails) end it "triggers use of Rails' logger if logger isn't set and Rails' logger exists" do rails = Module.new do def self.logger "RAILS LOGGER" end end define_constant("Rails", rails) CrashLog::Rails.initialize expect("RAILS LOGGER").to eq(CrashLog.logger) end describe 'auto configure logger' do before do Rails.stub(:logger).and_return(logger) logger.stub(:error) other_logger.stub(:error) end it 'detects presence of Rails logger' do CrashLog::Rails.__send__(:initialize) CrashLog.logger.should eq(logger) end it "allows overriding of the logger if already assigned" do CrashLog.logger.should_not == logger CrashLog::Rails.initialize CrashLog.logger.should == logger CrashLog.configure do |config| config.logger = other_logger end CrashLog.logger.should == other_logger end end end
Version data entries
4 entries across 4 versions & 1 rubygems