diff options
| author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-04 15:54:32 -0800 | 
|---|---|---|
| committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-04 18:14:59 -0800 | 
| commit | acccb72cb12ab55bb01c3dce32f54f4a59ebec6c (patch) | |
| tree | 8c4cc3cea1336efc12e242a0d6bf4ba18e5a9434 /activerecord/test | |
| parent | c94651f8c822f7c0778c03eb36bee5ca19f35911 (diff) | |
| download | rails-acccb72cb12ab55bb01c3dce32f54f4a59ebec6c.tar.gz rails-acccb72cb12ab55bb01c3dce32f54f4a59ebec6c.tar.bz2 rails-acccb72cb12ab55bb01c3dce32f54f4a59ebec6c.zip | |
column cache now lives on the connection pool
Diffstat (limited to 'activerecord/test')
| -rw-r--r-- | activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb | 4 | ||||
| -rw-r--r-- | activerecord/test/cases/connection_pool_test.rb | 20 | 
2 files changed, 22 insertions, 2 deletions
| diff --git a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb index 49cfac2170..55b611ca92 100644 --- a/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb @@ -757,10 +757,10 @@ class HasAndBelongsToManyAssociationsTest < ActiveRecord::TestCase      david = Developer.find(1)      # clear cache possibly created by other tests      david.projects.reset_column_information -    assert_queries(1) { david.projects.columns; david.projects.columns } +    assert_queries(0) { david.projects.columns; david.projects.columns }      # and again to verify that reset_column_information clears the cache correctly      david.projects.reset_column_information -    assert_queries(1) { david.projects.columns; david.projects.columns } +    assert_queries(0) { david.projects.columns; david.projects.columns }    end    def test_attributes_are_being_set_when_initialized_from_habm_association_with_where_clause diff --git a/activerecord/test/cases/connection_pool_test.rb b/activerecord/test/cases/connection_pool_test.rb index 0727e86705..55ac1bc406 100644 --- a/activerecord/test/cases/connection_pool_test.rb +++ b/activerecord/test/cases/connection_pool_test.rb @@ -99,6 +99,26 @@ module ActiveRecord          end.join()        end + +      def test_automatic_reconnect= +        pool = ConnectionPool.new ActiveRecord::Base.connection_pool.spec +        assert pool.automatic_reconnect +        assert pool.connection + +        pool.disconnect! +        assert pool.connection + +        pool.disconnect! +        pool.automatic_reconnect = false + +        assert_raises(ConnectionNotEstablished) do +          pool.connection +        end + +        assert_raises(ConnectionNotEstablished) do +          pool.with_connection +        end +      end      end    end  end | 
