Permalink
Browse files

We can conditional define the tests depending on the adapter or

connection.
  • Loading branch information...
1 parent def6071 commit ee36af1b773f1a6a58ff976b95d56dcce2d3c690 Rajarshi Das committed Apr 2, 2014
Showing with 5 additions and 7 deletions.
  1. +5 −7 activerecord/test/cases/adapter_test.rb
@@ -144,9 +144,9 @@ def test_uniqueness_violations_are_translated_to_specific_exception
@connection.execute "INSERT INTO subscribers(nick) VALUES('me')"
end
end
-
- def test_foreign_key_violations_are_translated_to_specific_exception
- unless current_adapter?(:SQLite3Adapter)
+
+ unless current_adapter?(:SQLite3Adapter)
+ def test_foreign_key_violations_are_translated_to_specific_exception
assert_raises(ActiveRecord::InvalidForeignKey) do
# Oracle adapter uses prefetched primary key values from sequence and passes them to connection adapter insert method
if @connection.prefetch_primary_key?
@@ -157,10 +157,8 @@ def test_foreign_key_violations_are_translated_to_specific_exception
end
end
end
- end
-
- def test_foreign_key_violations_are_translated_to_specific_exception_with_validate_false
- unless current_adapter?(:SQLite3Adapter)
+
+ def test_foreign_key_violations_are_translated_to_specific_exception_with_validate_false
klass_has_fk = Class.new(ActiveRecord::Base) do
self.table_name = 'fk_test_has_fk'
end

0 comments on commit ee36af1

Please sign in to comment.