validates_timeliness 3.0.15 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +21 -0
  3. data/CHANGELOG.rdoc +0 -5
  4. data/README.rdoc +5 -5
  5. data/gemfiles/rails_4_0.gemfile +19 -0
  6. data/gemfiles/rails_4_1.gemfile +19 -0
  7. data/gemfiles/rails_4_2.gemfile +19 -0
  8. data/lib/generators/validates_timeliness/templates/validates_timeliness.rb +2 -2
  9. data/lib/validates_timeliness.rb +1 -1
  10. data/lib/validates_timeliness/attribute_methods.rb +36 -36
  11. data/lib/validates_timeliness/extensions.rb +3 -4
  12. data/lib/validates_timeliness/extensions/date_time_select.rb +2 -9
  13. data/lib/validates_timeliness/extensions/multiparameter_handler.rb +59 -65
  14. data/lib/validates_timeliness/helper_methods.rb +8 -2
  15. data/lib/validates_timeliness/orm/active_record.rb +59 -13
  16. data/lib/validates_timeliness/validator.rb +13 -5
  17. data/lib/validates_timeliness/version.rb +1 -1
  18. data/spec/spec_helper.rb +3 -2
  19. data/spec/support/model_helpers.rb +4 -4
  20. data/spec/support/tag_matcher.rb +35 -0
  21. data/spec/support/test_model.rb +0 -1
  22. data/spec/validates_timeliness/attribute_methods_spec.rb +10 -10
  23. data/spec/validates_timeliness/conversion_spec.rb +41 -41
  24. data/spec/validates_timeliness/extensions/date_time_select_spec.rb +5 -4
  25. data/spec/validates_timeliness/extensions/multiparameter_handler_spec.rb +8 -7
  26. data/spec/validates_timeliness/helper_methods_spec.rb +8 -8
  27. data/spec/validates_timeliness/orm/active_record_spec.rb +37 -37
  28. data/spec/validates_timeliness/validator/after_spec.rb +3 -3
  29. data/spec/validates_timeliness/validator/before_spec.rb +3 -3
  30. data/spec/validates_timeliness/validator/is_at_spec.rb +4 -4
  31. data/spec/validates_timeliness/validator/on_or_after_spec.rb +3 -3
  32. data/spec/validates_timeliness/validator/on_or_before_spec.rb +3 -3
  33. data/spec/validates_timeliness/validator_spec.rb +26 -26
  34. data/spec/validates_timeliness_spec.rb +8 -8
  35. metadata +7 -11
  36. data/gemfiles/mongoid_2_1.gemfile +0 -16
  37. data/gemfiles/mongoid_2_2.gemfile +0 -16
  38. data/gemfiles/mongoid_2_3.gemfile +0 -16
  39. data/gemfiles/mongoid_2_4.gemfile +0 -16
  40. data/gemfiles/rails_3_0.gemfile +0 -15
  41. data/gemfiles/rails_3_1.gemfile +0 -15
  42. data/gemfiles/rails_3_2.gemfile +0 -15
  43. data/lib/validates_timeliness/orm/mongoid.rb +0 -49
  44. data/spec/validates_timeliness/orm/mongoid_spec.rb +0 -223
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ValidatesTimeliness::Extensions::DateTimeSelect do
3
+ describe 'ValidatesTimeliness::Extensions::DateTimeSelect' do
4
4
  include ActionView::Helpers::DateHelper
5
5
  attr_reader :person, :params
6
6
 
@@ -111,7 +111,7 @@ describe ValidatesTimeliness::Extensions::DateTimeSelect do
111
111
  @output = date_select(:person, :birth_date, :include_blank => true, :discard_day => true)
112
112
  should_have_datetime_selected(:birth_date, :year => 2009, :month => 'February')
113
113
  should_not_have_datetime_selected(:birth_time, :day)
114
- @output.should have_tag("input[id=person_birth_date_3i][type=hidden][value='1']")
114
+ expect(@output).to have_tag("input[id=person_birth_date_3i][type=hidden][value='1']")
115
115
  end
116
116
  end
117
117
 
@@ -150,14 +150,15 @@ describe ValidatesTimeliness::Extensions::DateTimeSelect do
150
150
  def should_have_datetime_selected(field, datetime_hash)
151
151
  datetime_hash.each do |key, value|
152
152
  index = {:year => 1, :month => 2, :day => 3, :hour => 4, :min => 5, :sec => 6}[key]
153
- @output.should have_tag("select[id=person_#{field}_#{index}i] option[selected=selected]", value.to_s)
153
+ expect(@output).to have_tag("select[id=person_#{field}_#{index}i] option[selected=selected]", value.to_s)
154
154
  end
155
155
  end
156
156
 
157
157
  def should_not_have_datetime_selected(field, *attributes)
158
158
  attributes.each do |attribute|
159
159
  index = {:year => 1, :month => 2, :day => 3, :hour => 4, :min => 5, :sec => 6}[attribute]
160
- @output.should_not have_tag("select[id=person_#{attribute}_#{index}i] option[selected=selected]")
160
+ expect(@output).not_to have_tag("select[id=person_#{attribute}_#{index}i] option[selected=selected]")
161
161
  end
162
162
  end
163
+
163
164
  end
@@ -1,38 +1,38 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe ValidatesTimeliness::Extensions::MultiparameterHandler do
3
+ describe 'ValidatesTimeliness::Extensions::MultiparameterHandler' do
4
4
 
5
5
  context "time column" do
6
6
  it 'should assign a string value for invalid date portion' do
7
7
  employee = record_with_multiparameter_attribute(:birth_datetime, [2000, 2, 31, 12, 0, 0])
8
- employee.birth_datetime_before_type_cast.should eq '2000-02-31 12:00:00'
8
+ expect(employee.birth_datetime_before_type_cast).to eq '2000-02-31 12:00:00'
9
9
  end
10
10
 
11
11
  it 'should assign a Time value for valid datetimes' do
12
12
  employee = record_with_multiparameter_attribute(:birth_datetime, [2000, 2, 28, 12, 0, 0])
13
- employee.birth_datetime_before_type_cast.should eq Time.zone.local(2000, 2, 28, 12, 0, 0)
13
+ expect(employee.birth_datetime_before_type_cast).to eq Time.zone.local(2000, 2, 28, 12, 0, 0)
14
14
  end
15
15
 
16
16
  it 'should assign a string value for incomplete time' do
17
17
  employee = record_with_multiparameter_attribute(:birth_datetime, [2000, nil, nil])
18
- employee.birth_datetime_before_type_cast.should eq '2000-00-00'
18
+ expect(employee.birth_datetime_before_type_cast).to eq '2000-00-00'
19
19
  end
20
20
  end
21
21
 
22
22
  context "date column" do
23
23
  it 'should assign a string value for invalid date' do
24
24
  employee = record_with_multiparameter_attribute(:birth_date, [2000, 2, 31])
25
- employee.birth_date_before_type_cast.should eq '2000-02-31'
25
+ expect(employee.birth_date_before_type_cast).to eq '2000-02-31'
26
26
  end
27
27
 
28
28
  it 'should assign a Date value for valid date' do
29
29
  employee = record_with_multiparameter_attribute(:birth_date, [2000, 2, 28])
30
- employee.birth_date_before_type_cast.should eq Date.new(2000, 2, 28)
30
+ expect(employee.birth_date_before_type_cast).to eq Date.new(2000, 2, 28)
31
31
  end
32
32
 
33
33
  it 'should assign a string value for incomplete date' do
34
34
  employee = record_with_multiparameter_attribute(:birth_date, [2000, nil, nil])
35
- employee.birth_date_before_type_cast.should eq '2000-00-00'
35
+ expect(employee.birth_date_before_type_cast).to eq '2000-00-00'
36
36
  end
37
37
  end
38
38
 
@@ -41,4 +41,5 @@ describe ValidatesTimeliness::Extensions::MultiparameterHandler do
41
41
  values.each_with_index {|value, index| hash["#{name}(#{index+1}i)"] = value.to_s }
42
42
  Employee.new(hash)
43
43
  end
44
+
44
45
  end
@@ -4,27 +4,27 @@ describe ValidatesTimeliness, 'HelperMethods' do
4
4
  let(:record) { Person.new }
5
5
 
6
6
  it 'should define class validation methods' do
7
- Person.should respond_to(:validates_date)
8
- Person.should respond_to(:validates_time)
9
- Person.should respond_to(:validates_datetime)
7
+ expect(Person).to respond_to(:validates_date)
8
+ expect(Person).to respond_to(:validates_time)
9
+ expect(Person).to respond_to(:validates_datetime)
10
10
  end
11
11
 
12
12
  it 'should define instance validation methods' do
13
- record.should respond_to(:validates_date)
14
- record.should respond_to(:validates_time)
15
- record.should respond_to(:validates_datetime)
13
+ expect(record).to respond_to(:validates_date)
14
+ expect(record).to respond_to(:validates_time)
15
+ expect(record).to respond_to(:validates_datetime)
16
16
  end
17
17
 
18
18
  it 'should validate instance using class validation defined' do
19
19
  Person.validates_date :birth_date
20
20
  record.valid?
21
21
 
22
- record.errors[:birth_date].should_not be_empty
22
+ expect(record.errors[:birth_date]).not_to be_empty
23
23
  end
24
24
 
25
25
  it 'should validate instance using instance valiation method' do
26
26
  record.validates_date :birth_date
27
27
 
28
- record.errors[:birth_date].should_not be_empty
28
+ expect(record.errors[:birth_date]).not_to be_empty
29
29
  end
30
30
  end
@@ -6,41 +6,41 @@ describe ValidatesTimeliness, 'ActiveRecord' do
6
6
  let(:record) { Employee.new }
7
7
 
8
8
  it 'should be defined for the class' do
9
- ActiveRecord::Base.should respond_to(:validates_date)
10
- ActiveRecord::Base.should respond_to(:validates_time)
11
- ActiveRecord::Base.should respond_to(:validates_datetime)
9
+ expect(ActiveRecord::Base).to respond_to(:validates_date)
10
+ expect(ActiveRecord::Base).to respond_to(:validates_time)
11
+ expect(ActiveRecord::Base).to respond_to(:validates_datetime)
12
12
  end
13
13
 
14
14
  it 'should defines for the instance' do
15
- record.should respond_to(:validates_date)
16
- record.should respond_to(:validates_time)
17
- record.should respond_to(:validates_datetime)
15
+ expect(record).to respond_to(:validates_date)
16
+ expect(record).to respond_to(:validates_time)
17
+ expect(record).to respond_to(:validates_datetime)
18
18
  end
19
19
 
20
20
  it "should validate a valid value string" do
21
21
  record.birth_date = '2012-01-01'
22
22
 
23
23
  record.valid?
24
- record.errors[:birth_date].should be_empty
24
+ expect(record.errors[:birth_date]).to be_empty
25
25
  end
26
26
 
27
27
  it "should validate a invalid value string" do
28
28
  record.birth_date = 'not a date'
29
29
 
30
30
  record.valid?
31
- record.errors[:birth_date].should_not be_empty
31
+ expect(record.errors[:birth_date]).not_to be_empty
32
32
  end
33
33
 
34
34
  it "should validate a nil value" do
35
35
  record.birth_date = nil
36
36
 
37
37
  record.valid?
38
- record.errors[:birth_date].should be_empty
38
+ expect(record.errors[:birth_date]).to be_empty
39
39
  end
40
40
  end
41
41
 
42
42
  it 'should determine type for attribute' do
43
- Employee.timeliness_attribute_type(:birth_date).should eq :date
43
+ expect(Employee.timeliness_attribute_type(:birth_date)).to eq :date
44
44
  end
45
45
 
46
46
  context 'attribute timezone awareness' do
@@ -58,17 +58,17 @@ describe ValidatesTimeliness, 'ActiveRecord' do
58
58
 
59
59
  context 'for column attribute' do
60
60
  it 'should be detected from column type' do
61
- klass.timeliness_attribute_timezone_aware?(:birth_date).should be_false
62
- klass.timeliness_attribute_timezone_aware?(:birth_time).should be_false
63
- klass.timeliness_attribute_timezone_aware?(:birth_datetime).should be_true
61
+ expect(klass.timeliness_attribute_timezone_aware?(:birth_date)).to be_falsey
62
+ expect(klass.timeliness_attribute_timezone_aware?(:birth_time)).to be_falsey
63
+ expect(klass.timeliness_attribute_timezone_aware?(:birth_datetime)).to be_truthy
64
64
  end
65
65
  end
66
66
 
67
67
  context 'for non-column attribute' do
68
68
  it 'should be detected from the validation type' do
69
- klass.timeliness_attribute_timezone_aware?(:some_date).should be_false
70
- klass.timeliness_attribute_timezone_aware?(:some_time).should be_false
71
- klass.timeliness_attribute_timezone_aware?(:some_datetime).should be_true
69
+ expect(klass.timeliness_attribute_timezone_aware?(:some_date)).to be_falsey
70
+ expect(klass.timeliness_attribute_timezone_aware?(:some_time)).to be_falsey
71
+ expect(klass.timeliness_attribute_timezone_aware?(:some_datetime)).to be_truthy
72
72
  end
73
73
  end
74
74
  end
@@ -88,7 +88,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
88
88
  it 'should store raw value' do
89
89
  record.birth_datetime = datetime_string = '2010-01-01 12:30'
90
90
 
91
- record._timeliness_raw_value_for('birth_datetime').should eq datetime_string
91
+ expect(record.read_timeliness_attribute_before_type_cast('birth_datetime')).to eq datetime_string
92
92
  end
93
93
  end
94
94
 
@@ -96,7 +96,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
96
96
  it 'should store raw value' do
97
97
  record.birth_date = date_string = '2010-01-01'
98
98
 
99
- record._timeliness_raw_value_for('birth_date').should eq date_string
99
+ expect(record.read_timeliness_attribute_before_type_cast('birth_date')).to eq date_string
100
100
  end
101
101
  end
102
102
 
@@ -104,7 +104,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
104
104
  it 'should store raw value' do
105
105
  record.birth_time = time_string = '12:12'
106
106
 
107
- record._timeliness_raw_value_for('birth_time').should eq time_string
107
+ expect(record.read_timeliness_attribute_before_type_cast('birth_time')).to eq time_string
108
108
  end
109
109
  end
110
110
  end
@@ -122,13 +122,13 @@ describe ValidatesTimeliness, 'ActiveRecord' do
122
122
 
123
123
  context "for a date column" do
124
124
  it 'should parse a string value' do
125
- Timeliness::Parser.should_receive(:parse)
125
+ expect(Timeliness::Parser).to receive(:parse)
126
126
 
127
127
  record.birth_date = '2010-01-01'
128
128
  end
129
129
 
130
130
  it 'should parse a invalid string value as nil' do
131
- Timeliness::Parser.should_receive(:parse)
131
+ expect(Timeliness::Parser).to receive(:parse)
132
132
 
133
133
  record.birth_date = 'not valid'
134
134
  end
@@ -136,20 +136,20 @@ describe ValidatesTimeliness, 'ActiveRecord' do
136
136
  it 'should store a Date value after parsing string' do
137
137
  record.birth_date = '2010-01-01'
138
138
 
139
- record.birth_date.should be_kind_of(Date)
140
- record.birth_date.should eq Date.new(2010, 1, 1)
139
+ expect(record.birth_date).to be_kind_of(Date)
140
+ expect(record.birth_date).to eq Date.new(2010, 1, 1)
141
141
  end
142
142
  end
143
143
 
144
144
  context "for a time column" do
145
145
  it 'should parse a string value' do
146
- Timeliness::Parser.should_receive(:parse)
146
+ expect(Timeliness::Parser).to receive(:parse)
147
147
 
148
148
  record.birth_time = '12:30'
149
149
  end
150
150
 
151
151
  it 'should parse a invalid string value as nil' do
152
- Timeliness::Parser.should_receive(:parse)
152
+ expect(Timeliness::Parser).to receive(:parse)
153
153
 
154
154
  record.birth_time = 'not valid'
155
155
  end
@@ -157,8 +157,8 @@ describe ValidatesTimeliness, 'ActiveRecord' do
157
157
  it 'should store a Time value after parsing string' do
158
158
  record.birth_time = '12:30'
159
159
 
160
- record.birth_time.should be_kind_of(Time)
161
- record.birth_time.should eq Time.utc(2000, 1, 1, 12, 30)
160
+ expect(record.birth_time).to be_kind_of(Time)
161
+ expect(record.birth_time).to eq Time.utc(2000, 1, 1, 12, 30)
162
162
  end
163
163
  end
164
164
 
@@ -166,13 +166,13 @@ describe ValidatesTimeliness, 'ActiveRecord' do
166
166
  with_config(:default_timezone, 'Australia/Melbourne')
167
167
 
168
168
  it 'should parse a string value' do
169
- Timeliness::Parser.should_receive(:parse)
169
+ expect(Timeliness::Parser).to receive(:parse)
170
170
 
171
171
  record.birth_datetime = '2010-01-01 12:00'
172
172
  end
173
173
 
174
174
  it 'should parse a invalid string value as nil' do
175
- Timeliness::Parser.should_receive(:parse)
175
+ expect(Timeliness::Parser).to receive(:parse)
176
176
 
177
177
  record.birth_datetime = 'not valid'
178
178
  end
@@ -180,13 +180,13 @@ describe ValidatesTimeliness, 'ActiveRecord' do
180
180
  it 'should parse string into Time value' do
181
181
  record.birth_datetime = '2010-01-01 12:00'
182
182
 
183
- record.birth_datetime.should be_kind_of(Time)
183
+ expect(record.birth_datetime).to be_kind_of(Time)
184
184
  end
185
185
 
186
186
  it 'should parse string as current timezone' do
187
187
  record.birth_datetime = '2010-06-01 12:00'
188
188
 
189
- record.birth_datetime.utc_offset.should eq Time.zone.utc_offset
189
+ expect(record.birth_datetime.utc_offset).to eq Time.zone.utc_offset
190
190
  end
191
191
  end
192
192
  end
@@ -199,7 +199,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
199
199
 
200
200
  record.reload
201
201
 
202
- record._timeliness_raw_value_for('birth_date').should be_nil
202
+ expect(record.read_timeliness_attribute_before_type_cast('birth_date')).to be_nil
203
203
  end
204
204
  end
205
205
 
@@ -207,13 +207,13 @@ describe ValidatesTimeliness, 'ActiveRecord' do
207
207
  let(:record) { Employee.new }
208
208
 
209
209
  it 'should be defined on class if ORM supports it' do
210
- record.should respond_to(:birth_datetime_before_type_cast)
210
+ expect(record).to respond_to(:birth_datetime_before_type_cast)
211
211
  end
212
212
 
213
213
  it 'should return original value' do
214
214
  record.birth_datetime = date_string = '2010-01-01'
215
215
 
216
- record.birth_datetime_before_type_cast.should eq date_string
216
+ expect(record.birth_datetime_before_type_cast).to eq date_string
217
217
  end
218
218
 
219
219
  it 'should return attribute if no attribute assignment has been made' do
@@ -221,7 +221,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
221
221
  Employee.create(:birth_datetime => datetime)
222
222
 
223
223
  record = Employee.last
224
- record.birth_datetime_before_type_cast.should match(/#{datetime.utc.to_s[0...-4]}/)
224
+ expect(record.birth_datetime_before_type_cast).to match(/#{datetime.utc.to_s[0...-4]}/)
225
225
  end
226
226
 
227
227
  context "with plugin parser" do
@@ -230,7 +230,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
230
230
  it 'should return original value' do
231
231
  record.birth_datetime = date_string = '2010-01-31'
232
232
 
233
- record.birth_datetime_before_type_cast.should eq date_string
233
+ expect(record.birth_datetime_before_type_cast).to eq date_string
234
234
  end
235
235
  end
236
236
 
@@ -238,7 +238,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
238
238
 
239
239
  context "define_attribute_methods" do
240
240
  it "returns a falsy value if the attribute methods have already been generated" do
241
- Employee.define_attribute_methods.should be_false
241
+ expect(Employee.define_attribute_methods).to be_falsey
242
242
  end
243
243
  end
244
244
  end
@@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":after option" do
25
25
  end
26
26
 
27
27
  it "should not be valid for same time as restriction" do
28
- invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0), 'must be after 12:00:00')
28
+ invalid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0), 'must be after 12:00:00')
29
29
  end
30
30
 
31
31
  it "should not be valid for time before restriction" do
32
- invalid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59), 'must be after 12:00:00')
32
+ invalid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59), 'must be after 12:00:00')
33
33
  end
34
34
 
35
35
  it "should be valid for time after restriction" do
36
- valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01))
36
+ valid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01))
37
37
  end
38
38
  end
39
39
 
@@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":before option" do
25
25
  end
26
26
 
27
27
  it "should not be valid for time after restriction" do
28
- invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01), 'must be before 12:00:00')
28
+ invalid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01), 'must be before 12:00:00')
29
29
  end
30
30
 
31
31
  it "should not be valid for same time as restriction" do
32
- invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0), 'must be before 12:00:00')
32
+ invalid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0), 'must be before 12:00:00')
33
33
  end
34
34
 
35
35
  it "should be valid for time before restriction" do
36
- valid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59))
36
+ valid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59))
37
37
  end
38
38
  end
39
39
 
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe ValidatesTimeliness::Validator, ":is_at option" do
4
4
  before do
5
- Timecop.freeze(Time.local_time(2010, 1, 1, 0, 0, 0))
5
+ Timecop.freeze(Time.local(2010, 1, 1, 0, 0, 0))
6
6
  end
7
7
 
8
8
  describe "for date type" do
@@ -29,15 +29,15 @@ describe ValidatesTimeliness::Validator, ":is_at option" do
29
29
  end
30
30
 
31
31
  it "should not be valid for time before restriction" do
32
- invalid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59), 'must be at 12:00:00')
32
+ invalid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59), 'must be at 12:00:00')
33
33
  end
34
34
 
35
35
  it "should not be valid for time after restriction" do
36
- invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01), 'must be at 12:00:00')
36
+ invalid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01), 'must be at 12:00:00')
37
37
  end
38
38
 
39
39
  it "should be valid for same time as restriction" do
40
- valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0))
40
+ valid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0))
41
41
  end
42
42
  end
43
43
 
@@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":on_or_after option" do
25
25
  end
26
26
 
27
27
  it "should not be valid for time before restriction" do
28
- invalid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59), 'must be on or after 12:00:00')
28
+ invalid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59), 'must be on or after 12:00:00')
29
29
  end
30
30
 
31
31
  it "should be valid for time after restriction" do
32
- valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01))
32
+ valid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01))
33
33
  end
34
34
 
35
35
  it "should be valid for same time as restriction" do
36
- valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0))
36
+ valid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0))
37
37
  end
38
38
  end
39
39
 
@@ -25,15 +25,15 @@ describe ValidatesTimeliness::Validator, ":on_or_before option" do
25
25
  end
26
26
 
27
27
  it "should not be valid for time after restriction" do
28
- invalid!(:birth_time, Time.local_time(2000, 1, 1, 12, 00, 01), 'must be on or before 12:00:00')
28
+ invalid!(:birth_time, Time.local(2000, 1, 1, 12, 00, 01), 'must be on or before 12:00:00')
29
29
  end
30
30
 
31
31
  it "should be valid for time before restriction" do
32
- valid!(:birth_time, Time.local_time(2000, 1, 1, 11, 59, 59))
32
+ valid!(:birth_time, Time.local(2000, 1, 1, 11, 59, 59))
33
33
  end
34
34
 
35
35
  it "should be valid for same time as restriction" do
36
- valid!(:birth_time, Time.local_time(2000, 1, 1, 12, 0, 0))
36
+ valid!(:birth_time, Time.local(2000, 1, 1, 12, 0, 0))
37
37
  end
38
38
  end
39
39