fix timezone issue for to_dummy_time as per normal Rails which uses AR default_timezone

This commit is contained in:
Adam Meehan
2008-12-05 16:34:28 +11:00
parent dbfd9231b5
commit bf999170d7
6 changed files with 17 additions and 16 deletions

View File

@@ -5,8 +5,8 @@ describe ValidatesTimeliness::CoreExtensions::Date do
@a_date = Date.new(2008, 7, 1)
end
it "should " do
@a_date.to_dummy_time.should == Time.mktime(2000,1,1,0,0,0)
it "should make a date value into a dummy time value" do
@a_date.to_dummy_time.should == Time.utc(2000,1,1,0,0,0)
end
end
@@ -15,8 +15,8 @@ describe ValidatesTimeliness::CoreExtensions::Time do
@a_time = Time.mktime(2008, 7, 1, 2, 3, 4)
end
it "should " do
@a_time.to_dummy_time.should == Time.mktime(2000,1,1,2,3,4)
it "should make a time value into a dummy time value" do
@a_time.to_dummy_time.should == Time.utc(2000,1,1,2,3,4)
end
end
@@ -25,7 +25,7 @@ describe ValidatesTimeliness::CoreExtensions::DateTime do
@a_datetime = DateTime.new(2008, 7, 1, 2, 3, 4)
end
it "should " do
@a_datetime.to_dummy_time.should == Time.mktime(2000,1,1,2,3,4)
it "should make a datetime value into a dummy time value" do
@a_datetime.to_dummy_time.should == Time.utc(2000,1,1,2,3,4)
end
end

View File

@@ -29,13 +29,12 @@ require 'action_view'
require 'spec/rails'
require 'time_travel/time_travel'
require 'validates_timeliness'
RAILS_VER = Rails::VERSION::STRING
puts "Using #{vendored ? 'vendored' : 'gem'} Rails version #{RAILS_VER} (ActiveRecord version #{ActiveRecord::VERSION::STRING})"
ActiveRecord::Base.default_timezone = :utc
RAILS_VER = Rails::VERSION::STRING
puts "Using #{vendored ? 'vendored' : 'gem'} Rails version #{RAILS_VER} (ActiveRecord version #{ActiveRecord::VERSION::STRING})"
require 'validates_timeliness'
if RAILS_VER >= '2.1'
Time.zone_default = ActiveSupport::TimeZone['UTC']