aboutsummaryrefslogtreecommitdiffstats
path: root/test/visitors/test_to_sql.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-10-25 07:38:56 -0500
committerSean Griffin <sean@thoughtbot.com>2014-10-25 07:38:56 -0500
commitf8d85cf24bca522a04edc5cc48f8716e65efb107 (patch)
tree400a9d564be166d15cb6566dd78cd251f8aeaef5 /test/visitors/test_to_sql.rb
parentdf5723dfbe856abc8c91cc87c609156b432e97d3 (diff)
downloadrails-f8d85cf24bca522a04edc5cc48f8716e65efb107.tar.gz
rails-f8d85cf24bca522a04edc5cc48f8716e65efb107.tar.bz2
rails-f8d85cf24bca522a04edc5cc48f8716e65efb107.zip
Deprecate passing ranges to `#in` and `#not_in`
The goal of these methods should be to generate in nodes, not handle every possible permutation of more than one value. The `#between` and `#not_between` methods have been extracted, which better represent the semantics of handling ranges in SQL.
Diffstat (limited to 'test/visitors/test_to_sql.rb')
-rw-r--r--test/visitors/test_to_sql.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/visitors/test_to_sql.rb b/test/visitors/test_to_sql.rb
index 62e1c57c73..9c18d74827 100644
--- a/test/visitors/test_to_sql.rb
+++ b/test/visitors/test_to_sql.rb
@@ -375,33 +375,33 @@ module Arel
end
it 'can handle two dot ranges' do
- node = @attr.in 1..3
+ node = @attr.between 1..3
compile(node).must_be_like %{
"users"."id" BETWEEN 1 AND 3
}
end
it 'can handle three dot ranges' do
- node = @attr.in 1...3
+ node = @attr.between 1...3
compile(node).must_be_like %{
"users"."id" >= 1 AND "users"."id" < 3
}
end
it 'can handle ranges bounded by infinity' do
- node = @attr.in 1..Float::INFINITY
+ node = @attr.between 1..Float::INFINITY
compile(node).must_be_like %{
"users"."id" >= 1
}
- node = @attr.in(-Float::INFINITY..3)
+ node = @attr.between(-Float::INFINITY..3)
compile(node).must_be_like %{
"users"."id" <= 3
}
- node = @attr.in(-Float::INFINITY...3)
+ node = @attr.between(-Float::INFINITY...3)
compile(node).must_be_like %{
"users"."id" < 3
}
- node = @attr.in(-Float::INFINITY..Float::INFINITY)
+ node = @attr.between(-Float::INFINITY..Float::INFINITY)
compile(node).must_be_like %{1=1}
end
@@ -479,33 +479,33 @@ module Arel
end
it 'can handle two dot ranges' do
- node = @attr.not_in 1..3
+ node = @attr.not_between 1..3
compile(node).must_equal(
%{("users"."id" < 1 OR "users"."id" > 3)}
)
end
it 'can handle three dot ranges' do
- node = @attr.not_in 1...3
+ node = @attr.not_between 1...3
compile(node).must_equal(
%{("users"."id" < 1 OR "users"."id" >= 3)}
)
end
it 'can handle ranges bounded by infinity' do
- node = @attr.not_in 1..Float::INFINITY
+ node = @attr.not_between 1..Float::INFINITY
compile(node).must_be_like %{
"users"."id" < 1
}
- node = @attr.not_in(-Float::INFINITY..3)
+ node = @attr.not_between(-Float::INFINITY..3)
compile(node).must_be_like %{
"users"."id" > 3
}
- node = @attr.not_in(-Float::INFINITY...3)
+ node = @attr.not_between(-Float::INFINITY...3)
compile(node).must_be_like %{
"users"."id" >= 3
}
- node = @attr.not_in(-Float::INFINITY..Float::INFINITY)
+ node = @attr.not_between(-Float::INFINITY..Float::INFINITY)
compile(node).must_be_like %{1=0}
end