mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix #not to stop wrapping in a grouping node
This commit is contained in:
parent
3d21dabaa6
commit
dbc86c0f2c
2 changed files with 5 additions and 8 deletions
|
@ -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
|
||||
|
||||
###
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue