Skip to content

Commit

Permalink
Improved test code [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Nov 8, 2022
1 parent bb794c2 commit afa36d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/multiple_databases_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def test_target_version_unconfigured
private

def with_database(database, &block)
previous_db_config = ActiveRecord::Base.connection_db_config.configuration_hash
previous_configurations = ActiveRecord::Base.configurations
previous_db_config = ActiveRecord::Base.connection_db_config.configuration_hash

ActiveRecord::Base.configurations = {
"test" => {
Expand All @@ -55,8 +55,8 @@ def with_database(database, &block)
ActiveRecord::Base.establish_connection(database)
yield
ensure
ActiveRecord::Base.establish_connection(previous_db_config) if previous_db_config
ActiveRecord::Base.configurations = previous_configurations if previous_configurations
ActiveRecord::Base.establish_connection(previous_db_config) if previous_db_config
end

def multiple_dbs?
Expand Down

0 comments on commit afa36d7

Please sign in to comment.