提交 0bb8429e 编写于 作者: J Jon Leighton

Reduce test noise

上级 021e4f16
...@@ -14,30 +14,24 @@ def setup ...@@ -14,30 +14,24 @@ def setup
@previously_updated_at = @developer.updated_at @previously_updated_at = @developer.updated_at
end end
def test_load_infinity_and_beyond if current_adapter?(:PostgreSQLAdapter)
unless current_adapter?(:PostgreSQLAdapter) def test_load_infinity_and_beyond
return skip("only tested on postgresql") 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 end
d = Developer.find_by_sql("select 'infinity'::timestamp as updated_at") def test_save_infinity_and_beyond
assert d.first.updated_at.infinite?, 'timestamp should be infinite' d = Developer.create!(:name => 'aaron', :updated_at => 1.0 / 0.0)
assert_equal(1.0 / 0.0, d.updated_at)
d = Developer.find_by_sql("select '-infinity'::timestamp as updated_at") d = Developer.create!(:name => 'aaron', :updated_at => -1.0 / 0.0)
time = d.first.updated_at assert_equal(-1.0 / 0.0, d.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 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
def test_saving_a_changed_record_updates_its_timestamp def test_saving_a_changed_record_updates_its_timestamp
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册