Permalink
Browse files

Do proper adapter check

  • Loading branch information...
1 parent 0e5fb0b commit 18b9595814057095084f508b6837ad3c7331079f @rafaelfranca rafaelfranca committed Mar 10, 2014
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/test/cases/finder_test.rb
@@ -64,7 +64,7 @@ def test_exists
def test_exists_fails_when_parameter_has_invalid_type
begin
assert_equal false, Topic.exists?(("9"*53).to_i) # number that's bigger than int
- flunk if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter and Topic.connection.is_a? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter # PostgreSQL does raise here
+ flunk if current_adapter?(:PostgreSQLAdapter) # PostgreSQL does raise here
rescue ActiveRecord::StatementInvalid
# PostgreSQL complains that it can't coerce a numeric that's bigger than int into int
rescue Exception
@@ -73,7 +73,7 @@ def test_exists_fails_when_parameter_has_invalid_type
begin
assert_equal false, Topic.exists?("foo")
- flunk if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter and Topic.connection.is_a? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter # PostgreSQL does raise here
+ flunk if current_adapter?(:PostgreSQLAdapter) # PostgreSQL does raise here
rescue ActiveRecord::StatementInvalid
# PostgreSQL complains about string comparison with integer field
rescue Exception

0 comments on commit 18b9595

Please sign in to comment.