Skip to content

Commit

Permalink
We can conditional define the tests depending on the adapter or
Browse files Browse the repository at this point in the history
connection.
  • Loading branch information
Rajarshi Das committed Apr 2, 2014
1 parent def6071 commit ee36af1
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions activerecord/test/cases/adapter_test.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ def test_uniqueness_violations_are_translated_to_specific_exception
@connection.execute "INSERT INTO subscribers(nick) VALUES('me')" @connection.execute "INSERT INTO subscribers(nick) VALUES('me')"
end end
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 assert_raises(ActiveRecord::InvalidForeignKey) do
# Oracle adapter uses prefetched primary key values from sequence and passes them to connection adapter insert method # Oracle adapter uses prefetched primary key values from sequence and passes them to connection adapter insert method
if @connection.prefetch_primary_key? if @connection.prefetch_primary_key?
Expand All @@ -157,10 +157,8 @@ def test_foreign_key_violations_are_translated_to_specific_exception
end end
end end
end end
end

def test_foreign_key_violations_are_translated_to_specific_exception_with_validate_false
def test_foreign_key_violations_are_translated_to_specific_exception_with_validate_false
unless current_adapter?(:SQLite3Adapter)
klass_has_fk = Class.new(ActiveRecord::Base) do klass_has_fk = Class.new(ActiveRecord::Base) do
self.table_name = 'fk_test_has_fk' self.table_name = 'fk_test_has_fk'
end end
Expand Down

0 comments on commit ee36af1

Please sign in to comment.