mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-24 23:06:42 +00:00
remove redundant dummy date setting from Parser
This commit is contained in:
parent
99ba103181
commit
cd62163152
@ -23,14 +23,6 @@ module ValidatesTimeliness
|
|||||||
cattr_accessor :ambiguous_year_threshold
|
cattr_accessor :ambiguous_year_threshold
|
||||||
self.ambiguous_year_threshold = 30
|
self.ambiguous_year_threshold = 30
|
||||||
|
|
||||||
# Set the dummy date part for a time type value. Should be an array of 3 values
|
|
||||||
# being year, month and day in that order.
|
|
||||||
#
|
|
||||||
# Default: [ 2000, 1, 1 ] same as ActiveRecord
|
|
||||||
#
|
|
||||||
cattr_accessor :dummy_date_for_time_type
|
|
||||||
self.dummy_date_for_time_type = [ 2000, 1, 1 ]
|
|
||||||
|
|
||||||
# Format tokens:
|
# Format tokens:
|
||||||
# y = year
|
# y = year
|
||||||
# m = month
|
# m = month
|
||||||
|
|||||||
@ -177,22 +177,6 @@ describe ValidatesTimeliness::Parser do
|
|||||||
ValidatesTimeliness::Parser.ambiguous_year_threshold = default
|
ValidatesTimeliness::Parser.ambiguous_year_threshold = default
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with custom dummy date values" do
|
|
||||||
before(:all) do
|
|
||||||
@old_dummy_date = ValidatesTimeliness.dummy_date_for_time_type
|
|
||||||
ValidatesTimeliness.dummy_date_for_time_type = [2009,1,1]
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should return time array with custom dummy date" do
|
|
||||||
time_array = formats._parse('12:13:14', :time, :strict => true)
|
|
||||||
time_array.should == [2009,1,1,12,13,14,0]
|
|
||||||
end
|
|
||||||
|
|
||||||
after(:all) do
|
|
||||||
ValidatesTimeliness.dummy_date_for_time_type = @old_dummy_date
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "parse" do
|
describe "parse" do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user