aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-12-09 14:52:11 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-09 14:52:11 -0800
commit6be1a71464f1e6833330b6cf9e239fd21b54c625 (patch)
treea5305d3fe7765902606a81136d2d2dc5e0691e2a /test
parent11e29a32af658ee0956b1237fea1033698a457e8 (diff)
downloadrails-6be1a71464f1e6833330b6cf9e239fd21b54c625.tar.gz
rails-6be1a71464f1e6833330b6cf9e239fd21b54c625.tar.bz2
rails-6be1a71464f1e6833330b6cf9e239fd21b54c625.zip
stop using deprecated AND usage
Diffstat (limited to 'test')
-rw-r--r--test/visitors/test_depth_first.rb12
-rw-r--r--test/visitors/test_to_sql.rb4
2 files changed, 13 insertions, 3 deletions
diff --git a/test/visitors/test_depth_first.rb b/test/visitors/test_depth_first.rb
index 1bee0328cf..1f1c7ab361 100644
--- a/test/visitors/test_depth_first.rb
+++ b/test/visitors/test_depth_first.rb
@@ -78,7 +78,6 @@ module Arel
end
[
- Arel::Nodes::And,
Arel::Nodes::Assignment,
Arel::Nodes::Between,
Arel::Nodes::DoesNotMatch,
@@ -106,6 +105,17 @@ module Arel
end
end
+ # N-ary
+ [
+ Arel::Nodes::And,
+ ].each do |klass|
+ define_method("test_#{klass.name.gsub('::', '_')}") do
+ binary = klass.new([:a, :b])
+ @visitor.accept binary
+ assert_equal [:a, :b, binary], @collector.calls
+ end
+ end
+
[
Arel::Attributes::Integer,
Arel::Attributes::Float,
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index c49d2a6bdf..80384d3c28 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -50,7 +50,7 @@ module Arel
end
it "should apply Not to the whole expression" do
- node = Nodes::And.new @attr.eq(10), @attr.eq(11)
+ 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
@@ -82,7 +82,7 @@ module Arel
end
it "should visit_Arel_Nodes_And" do
- node = Nodes::And.new @attr.eq(10), @attr.eq(11)
+ node = Nodes::And.new [@attr.eq(10), @attr.eq(11)]
@visitor.accept(node).must_be_like %{
"users"."id" = 10 AND "users"."id" = 11
}