diff options
author | Ryan Rempel <rgrempel@gmail.com> | 2010-12-04 12:08:19 -0600 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-06 09:51:13 -0800 |
commit | c28fe4cbbb1121394c6bb14403350723f9ecce4c (patch) | |
tree | c1fbe67ceafd8a1f8b5562350f1bbae5405e0de6 /test | |
parent | 516ae526b34333073df7a9835952d5d499197fdd (diff) | |
download | rails-c28fe4cbbb1121394c6bb14403350723f9ecce4c.tar.gz rails-c28fe4cbbb1121394c6bb14403350723f9ecce4c.tar.bz2 rails-c28fe4cbbb1121394c6bb14403350723f9ecce4c.zip |
Make "not" apply to the whole sub-expression when generating sql.
Diffstat (limited to 'test')
-rw-r--r-- | test/visitors/test_to_sql.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb index 1c5c8eac0c..5cbaaac501 100644 --- a/test/visitors/test_to_sql.rb +++ b/test/visitors/test_to_sql.rb @@ -40,7 +40,13 @@ module Arel it "should visit_Not" do sql = @visitor.accept Nodes::Not.new(Arel.sql("foo")) - sql.must_be_like "NOT foo" + sql.must_be_like "NOT (foo)" + end + + it "should apply Not to the whole expression" do + node = Nodes::And.new @attr.eq(10), @attr.eq(11) + sql = @visitor.accept Nodes::Not.new(node) + sql.must_be_like %{NOT ("users"."id" = 10 AND "users"."id" = 11)} end it "should visit_As" do |