aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters
diff options
context:
space:
mode:
authorPrem Sichanugrist <s@sikachu.com>2011-05-31 20:56:07 -0400
committerPrem Sichanugrist <s@sikachu.com>2011-05-31 20:56:07 -0400
commit2aaeac9a0a0165eb2cdd8ea00f25990cc6cc1a6e (patch)
treeee6ec14f8339101cda310857afdad8bd7b5b23af /activerecord/test/cases/adapters
parentcf3364a03c665374f6419a8875474ebf8623ea67 (diff)
downloadrails-2aaeac9a0a0165eb2cdd8ea00f25990cc6cc1a6e.tar.gz
rails-2aaeac9a0a0165eb2cdd8ea00f25990cc6cc1a6e.tar.bz2
rails-2aaeac9a0a0165eb2cdd8ea00f25990cc6cc1a6e.zip
Isolated PostgreSQL test into PostgreSQL folder
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r--activerecord/test/cases/adapters/postgresql/timestamp_test.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/timestamp_test.rb b/activerecord/test/cases/adapters/postgresql/timestamp_test.rb
new file mode 100644
index 0000000000..d3f48f5d77
--- /dev/null
+++ b/activerecord/test/cases/adapters/postgresql/timestamp_test.rb
@@ -0,0 +1,29 @@
+require 'cases/helper'
+
+class TimestampTest < ActiveRecord::TestCase
+ def test_load_infinity_and_beyond
+ unless current_adapter?(:PostgreSQLAdapter)
+ return skip("only tested on postgresql")
+ end
+
+ d = Developer.find_by_sql("select 'infinity'::timestamp as updated_at")
+ assert d.first.updated_at.infinite?, 'timestamp should be infinite'
+
+ d = Developer.find_by_sql("select '-infinity'::timestamp as updated_at")
+ time = d.first.updated_at
+ assert time.infinite?, 'timestamp should be infinite'
+ assert_operator time, :<, 0
+ end
+
+ def test_save_infinity_and_beyond
+ unless current_adapter?(:PostgreSQLAdapter)
+ return skip("only tested on postgresql")
+ end
+
+ d = Developer.create!(:name => 'aaron', :updated_at => 1.0 / 0.0)
+ assert_equal(1.0 / 0.0, d.updated_at)
+
+ d = Developer.create!(:name => 'aaron', :updated_at => -1.0 / 0.0)
+ assert_equal(-1.0 / 0.0, d.updated_at)
+ end
+end