Skip to content

Commit

Permalink
fixup! Clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bquorning committed Oct 12, 2023
1 parent d432482 commit afd212a
Showing 1 changed file with 40 additions and 40 deletions.
80 changes: 40 additions & 40 deletions test/helper.rb
Expand Up @@ -46,7 +46,46 @@ module ARHPTestSetup
def arhp_create_models
return if ARHPTestSetup.const_defined?('Pool1DbA')

unless ActiveRecord::Base.legacy_connection_handling
if ActiveRecord::Base.legacy_connection_handling
eval <<-RUBY
# The placement of the Pool1DbC class is important so that its
# connection will not be the most recent connection established
# for test_pool_1.
class Pool1DbC < ActiveRecord::Base
establish_connection(:test_pool_1_db_c)
end
class Pool1DbA < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_1_db_a)
end
class Pool1DbAReplica < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_1_db_a_replica)
end
class Pool1DbB < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_1_db_b)
end
class Pool2DbD < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_2_db_d)
end
class Pool2DbE < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_2_db_e)
end
class Pool3DbE < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_3_db_e)
end
RUBY
else
eval <<-RUBY
class AbstractPool1DbC < ActiveRecord::Base
self.abstract_class = true
Expand Down Expand Up @@ -119,45 +158,6 @@ class ShardedModel < AbstractShardedModel
self.table_name = "tests"
end
RUBY
else
eval <<-RUBY
# The placement of the Pool1DbC class is important so that its
# connection will not be the most recent connection established
# for test_pool_1.
class Pool1DbC < ActiveRecord::Base
establish_connection(:test_pool_1_db_c)
end
class Pool1DbA < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_1_db_a)
end
class Pool1DbAReplica < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_1_db_a_replica)
end
class Pool1DbB < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_1_db_b)
end
class Pool2DbD < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_2_db_d)
end
class Pool2DbE < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_2_db_e)
end
class Pool3DbE < ActiveRecord::Base
self.table_name = "tests"
establish_connection(:test_pool_3_db_e)
end
RUBY
end
end

Expand Down

0 comments on commit afd212a

Please sign in to comment.