1=2 is invalid expression in Oracle SELECT

This commit is contained in:
Raimonds Simanovskis 2009-03-23 00:03:34 +02:00
parent 5666a3ad06
commit 71c32d3cac

@ -75,13 +75,23 @@ def test_should_unserialize_attributes_for_frozen_records
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