diff options
Diffstat (limited to 'activerecord/test/cases/adapter_test.rb')
-rw-r--r-- | activerecord/test/cases/adapter_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 8688fbee49..80530194ff 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -137,4 +137,12 @@ class AdapterTest < ActiveRecord::TestCase @connection.execute "INSERT INTO subscribers(nick) VALUES('me')" end end + + def test_foreign_key_violations_are_translated_to_specific_exception + unless @connection.adapter_name == 'SQLite' + assert_raises(ActiveRecord::InvalidForeignKey) do + @connection.execute "INSERT INTO fk_test_has_fk (fk_id) VALUES (0)" + end + end + end end |