aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
diff options
context:
space:
mode:
authorDoug Cole <doug@estately.com>2012-03-31 18:41:24 -0700
committerDoug Cole <doug@estately.com>2012-03-31 18:41:24 -0700
commit945c53e7b54eff25e1cc1cf81ba6c96cce6664de (patch)
tree30ee94a7c63c1bdf371e81846e372d2b01456128 /activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
parent20615e74cb9153436f1a2f9f858bf55e093b424b (diff)
downloadrails-945c53e7b54eff25e1cc1cf81ba6c96cce6664de.tar.gz
rails-945c53e7b54eff25e1cc1cf81ba6c96cce6664de.tar.bz2
rails-945c53e7b54eff25e1cc1cf81ba6c96cce6664de.zip
improve test coverage
Diffstat (limited to 'activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb')
-rw-r--r--activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
index 19da6163b5..1452911974 100644
--- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
@@ -58,6 +58,32 @@ module ActiveRecord
@connection.use_returning = true
end
+ def test_exec_insert_with_returning_disabled
+ @connection.use_returning = false
+ result = @connection.exec_insert("insert into postgresql_partitioned_table_parent (number) VALUES (1)", nil, [], 'id', 'postgresql_partitioned_table_parent_id_seq')
+ expect = @connection.query('select max(id) from postgresql_partitioned_table_parent').first.first
+ assert_equal expect, result.rows.first.first
+ ensure
+ @connection.use_returning = true
+ end
+
+ def test_exec_insert_with_returning_disabled_and_no_sequence_name_given
+ @connection.use_returning = false
+ result = @connection.exec_insert("insert into postgresql_partitioned_table_parent (number) VALUES (1)", nil, [], 'id')
+ expect = @connection.query('select max(id) from postgresql_partitioned_table_parent').first.first
+ assert_equal expect, result.rows.first.first
+ ensure
+ @connection.use_returning = true
+ end
+
+ def test_sql_for_insert_with_returning_disabled
+ @connection.use_returning = false
+ result = @connection.sql_for_insert('sql', nil, nil, nil, 'binds')
+ assert_equal ['sql', 'binds'], result
+ ensure
+ @connection.use_returning = true
+ end
+
def test_serial_sequence
assert_equal 'public.accounts_id_seq',
@connection.serial_sequence('accounts', 'id')