Skip to content
Browse files

Merge pull request #14565 from rajcybage/conditional_test_cases

We can conditional define the tests depending on the adapter or connection.
  • Loading branch information...
2 parents def6071 + ee36af1 commit c82483a10abd30310f3360f6ebb6a4dddafdb2ba @rafaelfranca rafaelfranca committed
Showing with 5 additions and 7 deletions.
  1. +5 −7 activerecord/test/cases/adapter_test.rb
View
12 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 c82483a

Please sign in to comment.
Something went wrong with that request. Please try again.