diff options
author | Matthew Draper <matthew@trebex.net> | 2014-03-08 01:14:26 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-03-18 10:31:31 +1030 |
commit | cc0d54bcc09a8ab834041787df69f6795a468b91 (patch) | |
tree | b032e3fe551dabafed50b080cce9c3beb5eb9cbf /activerecord/test/cases | |
parent | 4a69c933cf07ee296a4ae1e2612c31922019eeab (diff) | |
download | rails-cc0d54bcc09a8ab834041787df69f6795a468b91.tar.gz rails-cc0d54bcc09a8ab834041787df69f6795a468b91.tar.bz2 rails-cc0d54bcc09a8ab834041787df69f6795a468b91.zip |
Teach PostgreSQLAdapter#reset! to actually reset
It wasn't doing anything beyond clearing the statement cache.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/connection_test.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/connection_test.rb b/activerecord/test/cases/adapters/postgresql/connection_test.rb index 4715fa002d..aa4996133f 100644 --- a/activerecord/test/cases/adapters/postgresql/connection_test.rb +++ b/activerecord/test/cases/adapters/postgresql/connection_test.rb @@ -45,6 +45,37 @@ module ActiveRecord assert_equal 'off', expect end + def test_reset + @connection.query('ROLLBACK') + @connection.query('SET geqo TO off') + + # Verify the setting has been applied. + expect = @connection.query('show geqo').first.first + assert_equal 'off', expect + + @connection.reset! + + # Verify the setting has been cleared. + expect = @connection.query('show geqo').first.first + assert_equal 'on', expect + end + + def test_reset_with_transaction + @connection.query('ROLLBACK') + @connection.query('SET geqo TO off') + + # Verify the setting has been applied. + expect = @connection.query('show geqo').first.first + assert_equal 'off', expect + + @connection.query('BEGIN') + @connection.reset! + + # Verify the setting has been cleared. + expect = @connection.query('show geqo').first.first + assert_equal 'on', expect + end + def test_tables_logs_name @connection.tables('hello') assert_equal 'SCHEMA', @subscriber.logged[0][1] |