diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-23 14:44:10 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-08-23 14:44:10 -0700 |
commit | c151df07acc06b06179c2dc6205db029ff9ce001 (patch) | |
tree | 24717fd5502ac9fa2634df8694e04aa800d3e287 /spec/arel | |
parent | 3bc3b145aedea216eb84e213bac1017c6090d42b (diff) | |
download | rails-c151df07acc06b06179c2dc6205db029ff9ce001.tar.gz rails-c151df07acc06b06179c2dc6205db029ff9ce001.tar.bz2 rails-c151df07acc06b06179c2dc6205db029ff9ce001.zip |
AND nodes are supported
Diffstat (limited to 'spec/arel')
-rw-r--r-- | spec/arel/nodes/equality_spec.rb | 11 | ||||
-rw-r--r-- | spec/arel/visitors/to_sql_spec.rb | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/arel/nodes/equality_spec.rb b/spec/arel/nodes/equality_spec.rb index b74af3a039..d91fa0df03 100644 --- a/spec/arel/nodes/equality_spec.rb +++ b/spec/arel/nodes/equality_spec.rb @@ -11,6 +11,17 @@ module Arel check node.right.should == right end end + + describe 'and' do + it 'makes and AND node' do + attr = Table.new(:users)[:id] + left = attr.eq(10) + right = attr.eq(11) + node = left.and right + check node.left.should == left + check node.right.should == right + end + end end end end diff --git a/spec/arel/visitors/to_sql_spec.rb b/spec/arel/visitors/to_sql_spec.rb index b70c392630..9807c89b3a 100644 --- a/spec/arel/visitors/to_sql_spec.rb +++ b/spec/arel/visitors/to_sql_spec.rb @@ -8,6 +8,13 @@ module Arel @attr = Table.new(:users)[:id] end + it "should visit_Arel_Nodes_And" do + node = Nodes::And.new @attr.eq(10), @attr.eq(11) + @visitor.accept(node).should be_like %{ + "users"."id" = 10 AND "users"."id" = 11 + } + end + it "should visit_Arel_Nodes_Or" do node = Nodes::Or.new @attr.eq(10), @attr.eq(11) @visitor.accept(node).should be_like %{ |