aboutsummaryrefslogtreecommitdiffstats
path: root/test/nodes/test_sql_literal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/nodes/test_sql_literal.rb')
-rw-r--r--test/nodes/test_sql_literal.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/nodes/test_sql_literal.rb b/test/nodes/test_sql_literal.rb
index 5cf91cef0c..d280d6d928 100644
--- a/test/nodes/test_sql_literal.rb
+++ b/test/nodes/test_sql_literal.rb
@@ -23,6 +23,30 @@ module Arel
viz.accept(node).must_be_like %{ COUNT(DISTINCT *) }
end
end
+
+ describe 'equality' do
+ it 'makes an equality node' do
+ node = SqlLiteral.new('foo').eq(1)
+ viz = Visitors::ToSql.new Table.engine
+ viz.accept(node).must_be_like %{ foo = 1 }
+ end
+ end
+
+ describe 'grouped "or" equality' do
+ it 'makes a grouping node with an or node' do
+ node = SqlLiteral.new('foo').eq_any([1,2])
+ viz = Visitors::ToSql.new Table.engine
+ viz.accept(node).must_be_like %{ (foo = 1 OR foo = 2) }
+ end
+ end
+
+ describe 'grouped "and" equality' do
+ it 'makes a grouping node with an or node' do
+ node = SqlLiteral.new('foo').eq_all([1,2])
+ viz = Visitors::ToSql.new Table.engine
+ viz.accept(node).must_be_like %{ (foo = 1 AND foo = 2) }
+ end
+ end
end
end
end