Sha256: c66b433d444f35bf8f7fa2725e4257b38dd7775d4ab21e75a57723b9fe1f964d
Contents?: true
Size: 830 Bytes
Versions: 2
Compression:
Stored size: 830 Bytes
Contents
require 'spec_helper' require 'logger' describe ActiveRecord::LogSubscriber do describe 'logging' do let(:log) { StringIO.new } let(:logger) { Logger.new(log) } before do ActiveRecord::Base.logger = logger @backup_disabled = Slavery.disabled end after do Slavery.disabled = @backup_disabled end it 'it prefixes log messages with master' do User.count log.rewind expect(log.read).to include('[master]') end it 'it prefixes log messages with the slave connection' do User.on_slave.count log.rewind expect(log.read).to include('[slave]') end it 'it does nothing when slavery is disabled' do Slavery.disabled = true User.count log.rewind expect(log.read).to_not include('[master]') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
slavery-3.0.0 | spec/active_record/log_subscriber_spec.rb |
slavery-2.1.1 | spec/active_record/log_subscriber_spec.rb |