aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRaimonds Simanovskis <raimonds.simanovskis@gmail.com>2009-03-23 00:03:34 +0200
committerRaimonds Simanovskis <raimonds.simanovskis@gmail.com>2009-08-06 23:40:59 +0300
commit71c32d3cacb7b0c0f0828caa5555f279777364fa (patch)
treea40795f1defad04775f3ad303ba7e7739e00de29 /activerecord
parent5666a3ad065469f12e5b3a4de0be823c9ae4ff7d (diff)
downloadrails-71c32d3cacb7b0c0f0828caa5555f279777364fa.tar.gz
rails-71c32d3cacb7b0c0f0828caa5555f279777364fa.tar.bz2
rails-71c32d3cacb7b0c0f0828caa5555f279777364fa.zip
1=2 is invalid expression in Oracle SELECT
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index ab8768ea3e..055590da0a 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -75,13 +75,23 @@ class AttributeMethodsTest < ActiveRecord::TestCase
def test_typecast_attribute_from_select_to_false
topic = Topic.create(:title => 'Budget')
- topic = Topic.find(:first, :select => "topics.*, 1=2 as is_test")
+ # Oracle does not support boolean expressions in SELECT
+ if current_adapter?(:OracleAdapter)
+ topic = Topic.find(:first, :select => "topics.*, 0 as is_test")
+ else
+ topic = Topic.find(:first, :select => "topics.*, 1=2 as is_test")
+ end
assert !topic.is_test?
end
def test_typecast_attribute_from_select_to_true
topic = Topic.create(:title => 'Budget')
- topic = Topic.find(:first, :select => "topics.*, 2=2 as is_test")
+ # Oracle does not support boolean expressions in SELECT
+ if current_adapter?(:OracleAdapter)
+ topic = Topic.find(:first, :select => "topics.*, 1 as is_test")
+ else
+ topic = Topic.find(:first, :select => "topics.*, 2=2 as is_test")
+ end
assert topic.is_test?
end