mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-25 15:22:58 +00:00
fixed fallback for out of range dates which Rails does not handle automatically
aliased timeliness_date_time_parse to parse_date_time for nicer interface
This commit is contained in:
@@ -186,6 +186,7 @@ describe ValidatesTimeliness::Formats do
|
||||
|
||||
after do
|
||||
formats.time_formats << 'h.nn_ampm'
|
||||
# reload class instead
|
||||
end
|
||||
end
|
||||
|
||||
@@ -223,6 +224,7 @@ describe ValidatesTimeliness::Formats do
|
||||
after do
|
||||
formats.time_formats.delete("h o'clock")
|
||||
formats.time_formats.delete("ss:hh:nn")
|
||||
# reload class instead
|
||||
end
|
||||
end
|
||||
|
||||
@@ -231,13 +233,12 @@ describe ValidatesTimeliness::Formats do
|
||||
time_array = formats.extract_date_time_values('01/02/2000', :date)
|
||||
time_array.should == [2000, 1, 2,nil,nil,nil,nil]
|
||||
formats.remove_us_formats
|
||||
puts formats.datetime_formats.inspect
|
||||
time_array = formats.extract_date_time_values('01/02/2000', :date)
|
||||
time_array.should == [2000, 2, 1,nil,nil,nil,nil]
|
||||
end
|
||||
|
||||
after do
|
||||
|
||||
# reload class
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -53,12 +53,10 @@ describe ValidatesTimeliness::Validations do
|
||||
@person.should be_valid
|
||||
end
|
||||
|
||||
# What is going on? No fall back.
|
||||
it "should be valid with values before out of Time range" do
|
||||
@person.birth_date_and_time = "1890-01-31 12:12:12"
|
||||
@person.birth_date = "1890-01-31"
|
||||
@person.birth_time = "23:59:59"
|
||||
puts @person.errors.inspect
|
||||
@person.should be_valid
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user