diff options
author | Arthur Neves <arthurnn@gmail.com> | 2016-05-04 00:46:38 -0500 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2016-05-05 15:29:11 -0500 |
commit | b83fb847337b690ebbc96c55414157f71bbf8aa2 (patch) | |
tree | 63dbbbcdcad26fc4b69925578bd8a7e2d3a1f687 /activerecord/test/cases/connection_pool_test.rb | |
parent | 3bed679670dd8348ffc348509a653677c6ecb7f3 (diff) | |
download | rails-b83fb847337b690ebbc96c55414157f71bbf8aa2.tar.gz rails-b83fb847337b690ebbc96c55414157f71bbf8aa2.tar.bz2 rails-b83fb847337b690ebbc96c55414157f71bbf8aa2.zip |
Refactor connection handler
ConnectionHandler will not have any knowlodge of AR models now, it will
only know about the specs.
Like that we can decouple the two, and allow the same model to use more
than one connection.
Historically, folks used to create abstract AR classes on the fly in
order to have multiple connections for the same model, and override the
connection methods.
With this, now we can override the `specificiation_id` method in the
model, to return a key, that will be used to find the connection_pool
from the handler.
Diffstat (limited to 'activerecord/test/cases/connection_pool_test.rb')
-rw-r--r-- | activerecord/test/cases/connection_pool_test.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb index efa3e0455e..55e90fd172 100644 --- a/activerecord/test/cases/connection_pool_test.rb +++ b/activerecord/test/cases/connection_pool_test.rb @@ -333,14 +333,14 @@ module ActiveRecord # make sure exceptions are thrown when establish_connection # is called with an anonymous class - def test_anonymous_class_exception - anonymous = Class.new(ActiveRecord::Base) - handler = ActiveRecord::Base.connection_handler - - assert_raises(RuntimeError) { - handler.establish_connection anonymous, nil - } - end +# def test_anonymous_class_exception +# anonymous = Class.new(ActiveRecord::Base) +# handler = ActiveRecord::Base.connection_handler +# +# assert_raises(RuntimeError) { +# handler.establish_connection anonymous, nil +# } +# end def test_pool_sets_connection_schema_cache connection = pool.checkout |