mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-25 07:16:41 +00:00
fix timezone issue for to_dummy_time as per normal Rails which uses AR default_timezone
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user