mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
Fix for running tests in non-Australian timezones
This commit is contained in:
parent
dd3b6b5514
commit
0d2c7ce554
@ -57,6 +57,7 @@ class PersonWithShim < Person
|
|||||||
include TestModelShim
|
include TestModelShim
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ActiveRecord::Base.default_timezone = :utc
|
||||||
ActiveRecord::Base.time_zone_aware_attributes = true
|
ActiveRecord::Base.time_zone_aware_attributes = true
|
||||||
ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', :database => ':memory:'})
|
ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', :database => ':memory:'})
|
||||||
ActiveRecord::Migration.verbose = false
|
ActiveRecord::Migration.verbose = false
|
||||||
|
|||||||
@ -10,7 +10,7 @@ describe ValidatesTimeliness::Extensions::MultiparameterHandler do
|
|||||||
|
|
||||||
it 'should assign a Time value for valid datetimes' do
|
it 'should assign a Time value for valid datetimes' do
|
||||||
employee = record_with_multiparameter_attribute(:birth_datetime, [2000, 2, 28, 12, 0, 0])
|
employee = record_with_multiparameter_attribute(:birth_datetime, [2000, 2, 28, 12, 0, 0])
|
||||||
employee.birth_datetime_before_type_cast.should eq Time.local(2000, 2, 28, 12, 0, 0)
|
employee.birth_datetime_before_type_cast.should eq Time.zone.local(2000, 2, 28, 12, 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should assign a string value for incomplete time' do
|
it 'should assign a string value for incomplete time' do
|
||||||
|
|||||||
@ -221,7 +221,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
|
|||||||
Employee.create(:birth_datetime => datetime)
|
Employee.create(:birth_datetime => datetime)
|
||||||
|
|
||||||
record = Employee.last
|
record = Employee.last
|
||||||
record.birth_datetime_before_type_cast.should match(/2010-01-01 00:00:00/)
|
record.birth_datetime_before_type_cast.should match(/#{datetime.utc.to_s[0...-4]}/)
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with plugin parser" do
|
context "with plugin parser" do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user