diff options
author | José Valim <jose.valim@gmail.com> | 2009-06-26 11:58:02 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-06-26 11:58:02 +0200 |
commit | 915f108d6a47b9c29e11ebe0b140ef017eb015b0 (patch) | |
tree | ae0c42330a9fbdc8395f8a5bae4605ef455c18c1 /activerecord/test | |
parent | aee63a12f2cfd110725c74686ae1eed58e18fda7 (diff) | |
parent | b5dfdc714fab7d2836e0a979ca88b4a17db9ec06 (diff) | |
download | rails-915f108d6a47b9c29e11ebe0b140ef017eb015b0.tar.gz rails-915f108d6a47b9c29e11ebe0b140ef017eb015b0.tar.bz2 rails-915f108d6a47b9c29e11ebe0b140ef017eb015b0.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapter_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 04770646b2..80530194ff 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -130,4 +130,19 @@ class AdapterTest < ActiveRecord::TestCase assert_equal " LIMIT 1,7 OFFSET 7", @connection.add_limit_offset!("", :limit=>sql_inject, :offset=>7) end end + + def test_uniqueness_violations_are_translated_to_specific_exception + @connection.execute "INSERT INTO subscribers(nick) VALUES('me')" + assert_raises(ActiveRecord::RecordNotUnique) do + @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 |