aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2015-03-22 20:24:09 +0100
committerLars Kanis <lars@greiz-reinsdorf.de>2015-03-22 21:26:50 +0100
commit8faff684ca24eb312eaa8473d07fc7214fd776d1 (patch)
tree5ff89ba1d873b21a4055196c20b7a15f712d48aa /activerecord/test
parentfdf55619652fc5200d000241c545323c46bd6b79 (diff)
downloadrails-8faff684ca24eb312eaa8473d07fc7214fd776d1.tar.gz
rails-8faff684ca24eb312eaa8473d07fc7214fd776d1.tar.bz2
rails-8faff684ca24eb312eaa8473d07fc7214fd776d1.zip
PostgreSQL, Add test case for "Infinity" string assignment to float columns.
This is implemented in Type::Float, but not tested, so far.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/adapters/postgresql/infinity_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/infinity_test.rb b/activerecord/test/cases/adapters/postgresql/infinity_test.rb
index 24199c69b8..d9d7832094 100644
--- a/activerecord/test/cases/adapters/postgresql/infinity_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/infinity_test.rb
@@ -24,6 +24,15 @@ class PostgresqlInfinityTest < ActiveRecord::TestCase
assert_equal Float::INFINITY, record.float
end
+ test "type casting string on a float column" do
+ record = PostgresqlInfinity.new(float: 'Infinity')
+ assert_equal Float::INFINITY, record.float
+ record = PostgresqlInfinity.new(float: '-Infinity')
+ assert_equal(-Float::INFINITY, record.float)
+ record = PostgresqlInfinity.new(float: 'NaN')
+ assert_send [record.float, :nan?]
+ end
+
test "update_all with infinity on a float column" do
record = PostgresqlInfinity.create!
PostgresqlInfinity.update_all(float: Float::INFINITY)