diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-11 06:00:59 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-11 06:00:59 -0700 |
commit | 539d684b7a063555bd2d03a36b2e778217d94ae9 (patch) | |
tree | f4525c4fe377dccac04d73bd5bb4993a4415de81 /activerecord | |
parent | 8f2e32158bb2e5a0a762861b085c0880320f315e (diff) | |
parent | 5399471820e24e316f3444b98eb3920baf23caf6 (diff) | |
download | rails-539d684b7a063555bd2d03a36b2e778217d94ae9.tar.gz rails-539d684b7a063555bd2d03a36b2e778217d94ae9.tar.bz2 rails-539d684b7a063555bd2d03a36b2e778217d94ae9.zip |
Merge pull request #1929 from sobrinho/master
Create a test case for disable_referential_integrity
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/adapter_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 07de544868..4c65193d75 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -146,4 +146,18 @@ class AdapterTest < ActiveRecord::TestCase end end end + + def test_disable_referential_integrity + assert_nothing_raised do + @connection.disable_referential_integrity do + # Oracle adapter uses prefetched primary key values from sequence and passes them to connection adapter insert method + if @connection.prefetch_primary_key? + id_value = @connection.next_sequence_value(@connection.default_sequence_name("fk_test_has_fk", "id")) + @connection.execute "INSERT INTO fk_test_has_fk (id, fk_id) VALUES (#{id_value},0)" + else + @connection.execute "INSERT INTO fk_test_has_fk (fk_id) VALUES (0)" + end + end + end + end end |