aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_factory_methods.rb10
-rw-r--r--test/visitors/test_to_sql.rb16
2 files changed, 26 insertions, 0 deletions
diff --git a/test/test_factory_methods.rb b/test/test_factory_methods.rb
index 50f77c3175..21671cd239 100644
--- a/test/test_factory_methods.rb
+++ b/test/test_factory_methods.rb
@@ -23,6 +23,16 @@ module Arel
assert_equal :one, on.expr
end
+ def test_create_true
+ true_node = @factory.create_true
+ assert_instance_of Nodes::True, true_node
+ end
+
+ def test_create_false
+ false_node = @factory.create_false
+ assert_instance_of Nodes::False, false_node
+ end
+
def test_lower
lower = @factory.lower :one
assert_instance_of Nodes::NamedFunction, lower
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index b52722ddd6..3b58c71cd8 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -325,6 +325,22 @@ module Arel
end
end
+ describe 'Constants' do
+ it "should handle true" do
+ test = Table.new(:users).create_true
+ @visitor.accept(test).must_be_like %{
+ TRUE
+ }
+ end
+
+ it "should handle false" do
+ test = Table.new(:users).create_false
+ @visitor.accept(test).must_be_like %{
+ FALSE
+ }
+ end
+ end
+
describe 'TableAlias' do
it "should use the underlying table for checking columns" do
test = Table.new(:users).alias('zomgusers')[:id].eq '3'