mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
139b92495f
* TestCase: introduce declared setup and teardown callbacks. Pass a list of methods and an optional block to call before setup or after teardown. Setup callbacks are run in the order declared; teardown callbacks are run in reverse. [Jeremy Kemper] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8570 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
16 lines
556 B
Ruby
16 lines
556 B
Ruby
require 'abstract_unit'
|
|
require 'fixtures/default'
|
|
|
|
class DefaultTest < ActiveSupport::TestCase
|
|
def test_default_timestamp
|
|
default = Default.new
|
|
assert_instance_of(Time, default.default_timestamp)
|
|
assert_equal(:datetime, default.column_for_attribute(:default_timestamp).type)
|
|
|
|
# Variance should be small; increase if required -- e.g., if test db is on
|
|
# remote host and clocks aren't synchronized.
|
|
t1 = Time.new
|
|
accepted_variance = 1.0
|
|
assert_in_delta(t1.to_f, default.default_timestamp.to_f, accepted_variance)
|
|
end
|
|
end
|