aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorArthur Neves <arthurnn@gmail.com>2016-05-11 13:37:14 -0400
committerArthur Neves <arthurnn@gmail.com>2016-05-11 13:39:26 -0400
commit537a342a8307ebe1d5e69a7e81495f137ae571a4 (patch)
tree0be0087446c5f14beaf8156bdd9a604a1629234e /activerecord/test
parent59d252196b36f6afaafd231756d69ea21537cf5d (diff)
downloadrails-537a342a8307ebe1d5e69a7e81495f137ae571a4.tar.gz
rails-537a342a8307ebe1d5e69a7e81495f137ae571a4.tar.bz2
rails-537a342a8307ebe1d5e69a7e81495f137ae571a4.zip
remove_connection should not remove parent connection
When calling remove_connection in a subclass, that should not fallback to the parent, otherwise it will remove the parent connection from the handler.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/connection_adapters/connection_handler_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_adapters/connection_handler_test.rb b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
index 2d3c411479..50f942f5aa 100644
--- a/activerecord/test/cases/connection_adapters/connection_handler_test.rb
+++ b/activerecord/test/cases/connection_adapters/connection_handler_test.rb
@@ -112,6 +112,13 @@ module ActiveRecord
klassA.connection_specification_name = "readonly"
assert_equal "readonly", klassB.connection_specification_name
end
+
+ def test_remove_connection_should_not_remove_parent
+ klass2 = Class.new(Base) { def self.name; 'klass2'; end }
+ klass2.remove_connection
+ refute_nil ActiveRecord::Base.connection.object_id
+ assert_equal klass2.connection.object_id, ActiveRecord::Base.connection.object_id
+ end
end
end
end