Sha256: 1fc5c1affe80ec913d181970f079936a50707c0250fd9732ef684577251e92a6

Contents?: true

Size: 534 Bytes

Versions: 8

Compression:

Stored size: 534 Bytes

Contents

require 'spec_helper'

describe Octopus::LogSubscriber, :shards => [:canada] do
  before :each do
    @out = StringIO.new
    @log = Logger.new(@out)
    ActiveRecord::Base.logger = @log
    ActiveRecord::Base.logger.level = Logger::DEBUG
  end

  after :each do
    ActiveRecord::Base.logger = Logger.new(File.open('database.log', 'a'))
  end

  it 'should add to the default logger the shard name the query was sent to' do
    User.using(:canada).create!(:name => 'test')
    expect(@out.string).to match(/Shard: canada/)
  end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
ar-octopus-ruby-3-0.11.3 spec/octopus/log_subscriber_spec.rb
ar-octopus-ruby-3-0.11.2 spec/octopus/log_subscriber_spec.rb
ar-octopus-0.10.2 spec/octopus/log_subscriber_spec.rb
ar-octopus-0.10.1 spec/octopus/log_subscriber_spec.rb
ar-octopus-0.10.0 spec/octopus/log_subscriber_spec.rb
ar-octopus-master-0.9.2.1 spec/octopus/log_subscriber_spec.rb
ar-octopus-0.9.2 spec/octopus/log_subscriber_spec.rb
ar-octopus-0.9.1 spec/octopus/log_subscriber_spec.rb