mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-25 07:16:41 +00:00
fix plugin parser timezone spec in AR
This commit is contained in:
parent
f41903a769
commit
7f297d576a
@ -10,6 +10,7 @@ class ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def timeliness_attribute_timezone_aware?(attr_name)
|
def timeliness_attribute_timezone_aware?(attr_name)
|
||||||
|
attr_name = attr_name.to_s
|
||||||
create_time_zone_conversion_attribute?(attr_name, columns_hash[attr_name])
|
create_time_zone_conversion_attribute?(attr_name, columns_hash[attr_name])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -51,11 +51,12 @@ describe ValidatesTimeliness, 'ActiveRecord' do
|
|||||||
|
|
||||||
it 'should parse string as current timezone' do
|
it 'should parse string as current timezone' do
|
||||||
r = EmployeeWithParser.new
|
r = EmployeeWithParser.new
|
||||||
r.birth_datetime = '2010-01-01 12:00'
|
r.birth_datetime = '2010-06-01 12:00'
|
||||||
r.birth_datetime.zone == Time.zone.name
|
r.birth_datetime.utc_offset.should == 10.hours
|
||||||
end
|
end
|
||||||
|
|
||||||
after :all do
|
after :all do
|
||||||
|
Time.zone = 'Australia/Melbourne'
|
||||||
ValidatesTimeliness.use_plugin_parser = false
|
ValidatesTimeliness.use_plugin_parser = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user