From f8d85cf24bca522a04edc5cc48f8716e65efb107 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Sat, 25 Oct 2014 07:38:56 -0500 Subject: 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. --- test/visitors/test_to_sql.rb | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'test/visitors') 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 -- cgit v1.2.3