aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-03-10 10:23:17 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-03-10 10:23:17 -0300
commitd547b2375465ec1a669f01386e988d32845eaa4c (patch)
treede240aada7cb0fc5701f4c4045970e8a7f4aaaac /activerecord/test/cases
parent18b9595814057095084f508b6837ad3c7331079f (diff)
downloadrails-d547b2375465ec1a669f01386e988d32845eaa4c.tar.gz
rails-d547b2375465ec1a669f01386e988d32845eaa4c.tar.bz2
rails-d547b2375465ec1a669f01386e988d32845eaa4c.zip
Change the assertions depending in the database adapter
This will avoid the confusing flunk logic
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/finder_test.rb23
1 files changed, 9 insertions, 14 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index 0ab3830323..0da2fe41c5 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -62,22 +62,17 @@ class FinderTest < ActiveRecord::TestCase
end
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 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
- flunk
- end
+ if current_adapter?(:PostgreSQLAdapter)
+ assert_raises ActiveRecord::StatementInvalid do
+ Topic.exists?(("9"*53).to_i) # number that's bigger than int
+ end
- begin
+ assert_raises ActiveRecord::StatementInvalid do
+ Topic.exists?("foo")
+ end
+ else
+ assert_equal false, Topic.exists?(("9"*53).to_i) # number that's bigger than int
assert_equal false, Topic.exists?("foo")
- flunk if current_adapter?(:PostgreSQLAdapter) # PostgreSQL does raise here
- rescue ActiveRecord::StatementInvalid
- # PostgreSQL complains about string comparison with integer field
- rescue Exception
- flunk
end
end