aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@github.com>2019-01-11 11:20:05 -0800
committerGitHub <noreply@github.com>2019-01-11 11:20:05 -0800
commit3a1b2a21965c0cd7bcccff586ce04b029eb4c359 (patch)
treecae3de24484064bf3b155db4413a23c2ac8074ce /activerecord/test
parentc11cf116f320990a537c0921bb9325f7fa22e34f (diff)
parent7110dbea008dd4b80d1764003935a3c97ab10f57 (diff)
downloadrails-3a1b2a21965c0cd7bcccff586ce04b029eb4c359.tar.gz
rails-3a1b2a21965c0cd7bcccff586ce04b029eb4c359.tar.bz2
rails-3a1b2a21965c0cd7bcccff586ce04b029eb4c359.zip
Merge pull request #34906 from gregnavis/add-endless-ranges-to-activerecord
Support endless ranges in where
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/arel/attributes/attribute_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/arel/attributes/attribute_test.rb b/activerecord/test/cases/arel/attributes/attribute_test.rb
index 671e273543..6ad54ab5df 100644
--- a/activerecord/test/cases/arel/attributes/attribute_test.rb
+++ b/activerecord/test/cases/arel/attributes/attribute_test.rb
@@ -639,6 +639,18 @@ module Arel
)
end
+ if Gem::Version.new("2.6.0") <= Gem::Version.new(RUBY_VERSION)
+ it "can be constructed with a range implicitly ending at Infinity" do
+ attribute = Attribute.new nil, nil
+ node = attribute.between(eval("0..")) # Use eval for compatibility with Ruby < 2.6 parser
+
+ node.must_equal Nodes::GreaterThanOrEqual.new(
+ attribute,
+ Nodes::Casted.new(0, attribute)
+ )
+ end
+ end
+
it "can be constructed with a quoted range ending at Infinity" do
attribute = Attribute.new nil, nil
node = attribute.between(quoted_range(0, ::Float::INFINITY, false))