diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-03-24 10:13:43 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-03-24 10:13:43 +0100 |
commit | 6a02efcfe560397a58fec53bd4ce177476f9cca7 (patch) | |
tree | 9afd898e12911dbc8c4e37f3ee14892bcc55705a /activerecord/test | |
parent | 41e6302cced434a82b669b37ff6684e18a54a765 (diff) | |
parent | 8faff684ca24eb312eaa8473d07fc7214fd776d1 (diff) | |
download | rails-6a02efcfe560397a58fec53bd4ce177476f9cca7.tar.gz rails-6a02efcfe560397a58fec53bd4ce177476f9cca7.tar.bz2 rails-6a02efcfe560397a58fec53bd4ce177476f9cca7.zip |
Merge pull request #19493 from larskanis/add_infinity_test
PostgreSQL, Add test case for "Infinity" string assignment to float columns
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/infinity_test.rb | 9 |
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) |