Skip to content

Commit

Permalink
[52] fixed failing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
rpbaltazar committed May 25, 2020
1 parent 2c51aab commit 52874a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion spec/adapters/jdbc_mysql_adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
subject { Apartment::Tenant.jdbc_mysql_adapter config.symbolize_keys }

def tenant_names
ActiveRecord::Base.connection.execute('SELECT schema_name FROM information_schema.schemata').collect { |row| row['schema_name'] }
ActiveRecord::Base.connection.execute('SELECT schema_name FROM information_schema.schemata').collect { |row| row[0] }
end

let(:default_tenant) { subject.switch { ActiveRecord::Base.connection.current_database } }
Expand Down
20 changes: 9 additions & 11 deletions spec/examples/generic_adapter_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,16 @@

describe '#init' do
it 'should not retain a connection after railtie' do
# this test should work on rails >= 4, the connection pool code is
# completely different for 3.2 so we'd have to have a messy conditional..
unless Rails::VERSION::MAJOR < 4
ActiveRecord::Base.connection_pool.disconnect!
ActiveRecord::Base.connection_pool.disconnect!

Apartment::Railtie.config.to_prepare_blocks.map(&:call)
Apartment::Railtie.config.to_prepare_blocks.map(&:call)

num_available_connections = Apartment.connection_class.connection_pool
.instance_variable_get(:@available)
.instance_variable_get(:@queue)
.size
num_available_connections = Apartment.connection_class.connection_pool
.instance_variable_get(:@available)
.instance_variable_get(:@queue)
.size

expect(num_available_connections).to eq(0)
end
expect(num_available_connections).to eq(0)
end
end

Expand All @@ -35,6 +31,8 @@
#
describe '#create' do
it 'should create the new databases' do
binding.pry

expect(tenant_names).to include(db1)
expect(tenant_names).to include(db2)
end
Expand Down

0 comments on commit 52874a8

Please sign in to comment.