Sha256: d700ac0c7ab619535359ea989e00b601572fc6b856339ec1f0f23fa6de55566a
Contents?: true
Size: 1.79 KB
Versions: 2
Compression:
Stored size: 1.79 KB
Contents
require "cases/helper" class PostgresqlInfinityTest < ActiveRecord::TestCase include InTimeZone class PostgresqlInfinity < ActiveRecord::Base end setup do @connection = ActiveRecord::Base.connection @connection.create_table(:postgresql_infinities) do |t| t.float :float t.datetime :datetime end end teardown do @connection.execute("DROP TABLE IF EXISTS postgresql_infinities") end test "type casting infinity on a float column" do record = PostgresqlInfinity.create!(float: Float::INFINITY) record.reload assert_equal Float::INFINITY, record.float end test "update_all with infinity on a float column" do record = PostgresqlInfinity.create! PostgresqlInfinity.update_all(float: Float::INFINITY) record.reload assert_equal Float::INFINITY, record.float end test "type casting infinity on a datetime column" do record = PostgresqlInfinity.create!(datetime: Float::INFINITY) record.reload assert_equal Float::INFINITY, record.datetime end test "update_all with infinity on a datetime column" do record = PostgresqlInfinity.create! PostgresqlInfinity.update_all(datetime: Float::INFINITY) record.reload assert_equal Float::INFINITY, record.datetime end test "assigning 'infinity' on a datetime column with TZ aware attributes" do begin in_time_zone "Pacific Time (US & Canada)" do record = PostgresqlInfinity.create!(datetime: "infinity") assert_equal Float::INFINITY, record.datetime assert_equal record.datetime, record.reload.datetime end ensure # setting time_zone_aware_attributes causes the types to change. # There is no way to do this automatically since it can be set on a superclass PostgresqlInfinity.reset_column_information end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activejob-lock-0.0.2 | rails/activerecord/test/cases/adapters/postgresql/infinity_test.rb |
activejob-lock-0.0.1 | rails/activerecord/test/cases/adapters/postgresql/infinity_test.rb |