mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
Change Time.local_time to Time.local
This commit is contained in:
parent
d0f2158ae5
commit
6560a09ad2
@ -52,7 +52,7 @@ describe ValidatesTimeliness::Conversion do
|
||||
|
||||
describe "for datetime type" do
|
||||
it "should return Date as Time value" do
|
||||
type_cast_value(Date.new(2010, 1, 1), :datetime).should == Time.local_time(2010, 1, 1, 0, 0, 0)
|
||||
type_cast_value(Date.new(2010, 1, 1), :datetime).should == Time.local(2010, 1, 1, 0, 0, 0)
|
||||
end
|
||||
|
||||
it "should return same Time value" do
|
||||
|
||||
@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":after option" do
|
||||
end
|
||||
|
||||
it "should not be valid for same time as restriction" do
|
||||
invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0), 'must be after 12:00:00')
|
||||
invalid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0), 'must be after 12:00:00')
|
||||
end
|
||||
|
||||
it "should not be valid for time before restriction" do
|
||||
invalid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59), 'must be after 12:00:00')
|
||||
invalid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59), 'must be after 12:00:00')
|
||||
end
|
||||
|
||||
it "should be valid for time after restriction" do
|
||||
valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01))
|
||||
valid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":before option" do
|
||||
end
|
||||
|
||||
it "should not be valid for time after restriction" do
|
||||
invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01), 'must be before 12:00:00')
|
||||
invalid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01), 'must be before 12:00:00')
|
||||
end
|
||||
|
||||
it "should not be valid for same time as restriction" do
|
||||
invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0), 'must be before 12:00:00')
|
||||
invalid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0), 'must be before 12:00:00')
|
||||
end
|
||||
|
||||
it "should be valid for time before restriction" do
|
||||
valid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59))
|
||||
valid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe ValidatesTimeliness::Validator, ":is_at option" do
|
||||
before do
|
||||
Timecop.freeze(Time.local_time(2010, 1, 1, 0, 0, 0))
|
||||
Timecop.freeze(Time.local(2010, 1, 1, 0, 0, 0))
|
||||
end
|
||||
|
||||
describe "for date type" do
|
||||
@ -29,15 +29,15 @@ describe ValidatesTimeliness::Validator, ":is_at option" do
|
||||
end
|
||||
|
||||
it "should not be valid for time before restriction" do
|
||||
invalid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59), 'must be at 12:00:00')
|
||||
invalid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59), 'must be at 12:00:00')
|
||||
end
|
||||
|
||||
it "should not be valid for time after restriction" do
|
||||
invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01), 'must be at 12:00:00')
|
||||
invalid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01), 'must be at 12:00:00')
|
||||
end
|
||||
|
||||
it "should be valid for same time as restriction" do
|
||||
valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0))
|
||||
valid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":on_or_after option" do
|
||||
end
|
||||
|
||||
it "should not be valid for time before restriction" do
|
||||
invalid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59), 'must be on or after 12:00:00')
|
||||
invalid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59), 'must be on or after 12:00:00')
|
||||
end
|
||||
|
||||
it "should be valid for time after restriction" do
|
||||
valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01))
|
||||
valid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01))
|
||||
end
|
||||
|
||||
it "should be valid for same time as restriction" do
|
||||
valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0))
|
||||
valid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":on_or_before option" do
|
||||
end
|
||||
|
||||
it "should not be valid for time after restriction" do
|
||||
invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01), 'must be on or before 12:00:00')
|
||||
invalid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01), 'must be on or before 12:00:00')
|
||||
end
|
||||
|
||||
it "should be valid for time before restriction" do
|
||||
valid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59))
|
||||
valid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59))
|
||||
end
|
||||
|
||||
it "should be valid for same time as restriction" do
|
||||
valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0))
|
||||
valid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe ValidatesTimeliness::Validator do
|
||||
before do
|
||||
Timecop.freeze(Time.local_time(2010, 1, 1, 0, 0, 0))
|
||||
Timecop.freeze(Time.local(2010, 1, 1, 0, 0, 0))
|
||||
end
|
||||
|
||||
describe "Model.validates with :timeliness option" do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user