Sha256: b78d504fd3cd64236936ea5910934fc8d13b8e2926a36d9ae470adc0c019921e

Contents?: true

Size: 913 Bytes

Versions: 6

Compression:

Stored size: 913 Bytes

Contents

require "spec_helper"

module Switchman
  module ActiveRecord
    describe ConnectionPool do
      it "should be able to access another shard on a db server after the 'primary' shard is gone" do
        pending 'A "real" database"' unless Shard.default.database_server.shareable?
        # separate connections
        server = DatabaseServer.create(:config => Shard.default.database_server.config.dup)
        s1 = server.shards.create!(:name => 'non_existent_shard') # don't actually create any schema
        s2 = server.shards.create! # inherit's the default shard's config, which is functional
        s1.activate do
          lambda { User.count }.should raise_exception
        end
        # the config for s1 should not be the permanent default for all new
        # connections now
        s2.activate do
          lambda { User.count }.should_not raise_exception
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
switchman-1.2.2 spec/lib/active_record/connection_pool_spec.rb
switchman-1.2.1 spec/lib/active_record/connection_pool_spec.rb
switchman-1.2.0 spec/lib/active_record/connection_pool_spec.rb
switchman-1.1.0 spec/lib/active_record/connection_pool_spec.rb
switchman-1.0.0 spec/lib/active_record/connection_pool_spec.rb
switchman-0.0.1 spec/lib/active_record/connection_pool_spec.rb