aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-02-21 11:36:50 -0500
committerGitHub <noreply@github.com>2017-02-21 11:36:50 -0500
commitf24348331e9de005c0dfa5044621de77d25dce76 (patch)
tree7fcb3a1f88f1cf8669fc02a92e571e5dd87e38a2 /test
parent208fe3690d840d0ee65b1395a891886e58fd3f4b (diff)
parentd8a41890e0135666606167e8ea7e62b951863de6 (diff)
downloadrails-f24348331e9de005c0dfa5044621de77d25dce76.tar.gz
rails-f24348331e9de005c0dfa5044621de77d25dce76.tar.bz2
rails-f24348331e9de005c0dfa5044621de77d25dce76.zip
Merge pull request #470 from kmmndr/named_function_eq_nil
named functions compared to nil
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_to_sql.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index 07458c1dc5..31279b0ae2 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -62,6 +62,12 @@ module Arel
sql.must_be_like %{ omg(*) = 2 }
end
+ it 'should handle nil with named functions' do
+ function = Nodes::NamedFunction.new('omg', [Arel.star])
+ sql = compile(function.eq(nil))
+ sql.must_be_like %{ omg(*) IS NULL }
+ end
+
it 'should visit built-in functions' do
function = Nodes::Count.new([Arel.star])
assert_equal 'COUNT(*)', compile(function)