Change Time.local_time to Time.local

This commit is contained in:
Adam Meehan 2015-12-28 13:47:11 +11:00
parent d0f2158ae5
commit 6560a09ad2
7 changed files with 18 additions and 18 deletions

View File

@ -52,7 +52,7 @@ describe ValidatesTimeliness::Conversion do
describe "for datetime type" do describe "for datetime type" do
it "should return Date as Time value" 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 end
it "should return same Time value" do it "should return same Time value" do

View File

@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":after option" do
end end
it "should not be valid for same time as restriction" do 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 end
it "should not be valid for time before restriction" do 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 end
it "should be valid for time after restriction" do 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
end end

View File

@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":before option" do
end end
it "should not be valid for time after restriction" do 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 end
it "should not be valid for same time as restriction" do 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 end
it "should be valid for time before restriction" do 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
end end

View File

@ -2,7 +2,7 @@ require 'spec_helper'
describe ValidatesTimeliness::Validator, ":is_at option" do describe ValidatesTimeliness::Validator, ":is_at option" do
before 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 end
describe "for date type" do describe "for date type" do
@ -29,15 +29,15 @@ describe ValidatesTimeliness::Validator, ":is_at option" do
end end
it "should not be valid for time before restriction" do 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 end
it "should not be valid for time after restriction" do 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 end
it "should be valid for same time as restriction" do 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
end end

View File

@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":on_or_after option" do
end end
it "should not be valid for time before restriction" do 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 end
it "should be valid for time after restriction" do 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
it "should be valid for same time as restriction" do 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
end end

View File

@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":on_or_before option" do
end end
it "should not be valid for time after restriction" do 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 end
it "should be valid for time before restriction" do 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
it "should be valid for same time as restriction" do 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
end end

View File

@ -2,7 +2,7 @@ require 'spec_helper'
describe ValidatesTimeliness::Validator do describe ValidatesTimeliness::Validator do
before 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 end
describe "Model.validates with :timeliness option" do describe "Model.validates with :timeliness option" do