diff options
author | Ernie Miller <ernie@metautonomo.us> | 2011-02-11 12:08:32 -0500 |
---|---|---|
committer | Ernie Miller <ernie@metautonomo.us> | 2011-02-11 12:08:32 -0500 |
commit | dbc86c0f2c2fc3c8bacf35c67fb8e0967b0a8980 (patch) | |
tree | 75f482e0cc0fb5a10422b0ea576cde1181fb2338 | |
parent | 3d21dabaa6c214ab2f2941c063bd7de04fd95202 (diff) | |
download | rails-dbc86c0f2c2fc3c8bacf35c67fb8e0967b0a8980.tar.gz rails-dbc86c0f2c2fc3c8bacf35c67fb8e0967b0a8980.tar.bz2 rails-dbc86c0f2c2fc3c8bacf35c67fb8e0967b0a8980.zip |
Fix #not to stop wrapping in a grouping node
-rw-r--r-- | lib/arel/nodes/node.rb | 2 | ||||
-rw-r--r-- | test/nodes/test_not.rb | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/lib/arel/nodes/node.rb b/lib/arel/nodes/node.rb index 711fa34b6d..1a5bc27856 100644 --- a/lib/arel/nodes/node.rb +++ b/lib/arel/nodes/node.rb @@ -10,7 +10,7 @@ module Arel # Factory method to create a Nodes::Not node that has the recipient of # the caller as a child. def not - Nodes::Not.new Nodes::Grouping.new self + Nodes::Not.new self end ### diff --git a/test/nodes/test_not.rb b/test/nodes/test_not.rb index d02a9bad74..c5bb0088c8 100644 --- a/test/nodes/test_not.rb +++ b/test/nodes/test_not.rb @@ -6,13 +6,10 @@ module Arel describe '#not' do it 'makes a NOT node' do attr = Table.new(:users)[:id] - left = attr.eq(10) - right = attr.eq(11) - node = left.or right - node.expr.left.must_equal left - node.expr.right.must_equal right - - node.or(right).not + expr = attr.eq(10) + node = expr.not + node.must_be_kind_of Not + node.expr.must_equal expr end end end |