validates_timeliness 6.0.0.beta2 → 7.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,130 +1,126 @@
1
1
  # ValidatesTimeliness [![build](https://github.com/adzap/validates_timeliness/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/adzap/validates_timeliness/actions/workflows/ci.yml)
2
2
 
3
- * Source: https://github.com/adzap/validates_timeliness
4
- * Issues: https://github.com/adzap/validates_timeliness/issues
3
+ - Source: https://github.com/adzap/validates_timeliness
4
+ - Issues: https://github.com/adzap/validates_timeliness/issues
5
5
 
6
6
 
7
7
  ## Description
8
8
 
9
- Complete validation of dates, times and datetimes for Rails 6.x and
10
- ActiveModel.
9
+ Complete validation of dates, times and datetimes for Rails 7.x and ActiveModel.
11
10
 
12
- Old Rails versions:
11
+ Older Rails versions:
13
12
 
14
- * Rails 4.x: [https://github.com/adzap/validates_timeliness/tree/4-0-stable]
15
-
16
- * Rails 5.x: [https://github.com/adzap/validates_timeliness/tree/5-0-stable]
13
+ - Rails 4.x: [https://github.com/adzap/validates_timeliness/tree/4-0-stable]
14
+ - Rails 5.x: [https://github.com/adzap/validates_timeliness/tree/5-0-stable]
15
+ - Rails 6.x: [https://github.com/adzap/validates_timeliness/tree/6-0-stable]
17
16
 
18
17
 
19
18
  ## Features
20
19
 
21
- * Adds validation for dates, times and datetimes to ActiveModel
22
-
23
- * Handles timezones and type casting of values for you
24
-
25
- * Only Rails date/time validation plugin offering complete validation (See
26
- ORM/ODM support)
27
-
28
- * Uses extensible date/time parser (Using [timeliness
29
- gem](https://github.com/adzap/timeliness). See Plugin Parser)
30
-
31
- * Adds extensions to fix Rails date/time select issues (See Extensions)
32
-
33
- * Supports I18n for the error messages. For multi-language support try
34
- [timeliness-i18n gem](https://github.com/pedrofurtado/timeliness-i18n).
35
-
36
- * Supports all the Rubies (that any sane person would be using in
37
- production).
20
+ - Adds validation for dates, times and datetimes to ActiveModel
21
+ - Handles timezones and type casting of values for you
22
+ - Only Rails date/time validation plugin offering complete validation (See ORM/ODM support)
23
+ - Uses extensible date/time parser (Using [timeliness gem](https://github.com/adzap/timeliness). See Plugin Parser)
24
+ - Adds extensions to fix Rails date/time select issues (See Extensions)
25
+ - Supports I18n for the error messages. For multi-language support try [timeliness-i18n gem](https://github.com/pedrofurtado/timeliness-i18n).
26
+ - Supports all the Rubies (that any sane person would be using in production).
38
27
 
39
28
 
40
29
  ## Installation
41
30
 
42
- # in Gemfile
43
- gem 'validates_timeliness', '~> 6.0.0.alpha1'
31
+ In Gemfile
32
+ ```ruby
33
+ gem 'validates_timeliness', '~> 7.0.0.beta1'
34
+ ```
44
35
 
45
- # Run bundler
46
- $ bundle install
36
+ Run bundler:
37
+ ```bash
38
+ $ bundle install
39
+ ```
47
40
 
48
41
  Then run
42
+ ```bash
43
+ $ rails generate validates_timeliness:install
44
+ ```
49
45
 
50
- $ rails generate validates_timeliness:install
46
+ This creates configuration initializer and locale files. In the initializer, there are a number of config options to customize the plugin.
51
47
 
52
- This creates configuration initializer and locale files. In the initializer,
53
- there are a number of config options to customize the plugin.
54
-
55
- NOTE: You may wish to enable the plugin parser and the extensions to start.
48
+ **NOTE**: You may wish to enable the plugin parser and the extensions to start.
56
49
  Please read those sections first.
57
50
 
58
51
  ## Examples
59
52
 
60
- validates_datetime :occurred_at
53
+ ```ruby
54
+ validates_datetime :occurred_at
61
55
 
62
- validates_date :date_of_birth, before: lambda { 18.years.ago },
63
- before_message: "must be at least 18 years old"
56
+ validates_date :date_of_birth, before: lambda { 18.years.ago },
57
+ before_message: "must be at least 18 years old"
64
58
 
65
- validates_datetime :finish_time, after: :start_time # Method symbol
59
+ validates_datetime :finish_time, after: :start_time # Method symbol
66
60
 
67
- validates_date :booked_at, on: :create, on_or_after: :today # See Restriction Shorthand.
61
+ validates_date :booked_at, on: :create, on_or_after: :today # See Restriction Shorthand.
68
62
 
69
- validates_time :booked_at, between: ['9:00am', '5:00pm'] # On or after 9:00AM and on or before 5:00PM
70
- validates_time :booked_at, between: '9:00am'..'5:00pm' # The same as previous example
71
- validates_time :booked_at, between: '9:00am'...'5:00pm' # On or after 9:00AM and strictly before 5:00PM
63
+ validates_time :booked_at, between: ['9:00am', '5:00pm'] # On or after 9:00AM and on or before 5:00PM
64
+ validates_time :booked_at, between: '9:00am'..'5:00pm' # The same as previous example
65
+ validates_time :booked_at, between: '9:00am'...'5:00pm' # On or after 9:00AM and strictly before 5:00PM
72
66
 
73
- validates_time :breakfast_time, on_or_after: '6:00am',
74
- on_or_after_message: 'must be after opening time',
75
- before: :lunchtime,
76
- before_message: 'must be before lunch time'
67
+ validates_time :breakfast_time, on_or_after: '6:00am',
68
+ on_or_after_message: 'must be after opening time',
69
+ before: :lunchtime,
70
+ before_message: 'must be before lunch time'
71
+ ```
77
72
 
78
73
  ## Usage
79
74
 
80
75
  To validate a model with a date, time or datetime attribute you just use the
81
- validation method
76
+ validation method:
82
77
 
83
- class Person < ActiveRecord::Base
84
- validates_date :date_of_birth, on_or_before: lambda { Date.current }
85
- # or
86
- validates :date_of_birth, timeliness: {on_or_before: lambda { Date.current }, type: :date}
87
- end
78
+ ```ruby
79
+ class Person < ActiveRecord::Base
80
+ validates_date :date_of_birth, on_or_before: lambda { Date.current }
81
+ # or
82
+ validates :date_of_birth, timeliness: { on_or_before: lambda { Date.current }, type: :date }
83
+ end
84
+ ```
88
85
 
89
86
  or even on a specific record, per ActiveModel API.
90
-
91
- @person.validates_date :date_of_birth, on_or_before: lambda { Date.current }
87
+ ```ruby
88
+ @person.validates_date :date_of_birth, on_or_before: lambda { Date.current }
89
+ ```
92
90
 
93
91
  The list of validation methods available are as follows:
94
- validates_date - validate value as date
95
- validates_time - validate value as time only i.e. '12:20pm'
96
- validates_datetime - validate value as a full date and time
97
- validates - use the :timeliness key and set the type in the hash.
92
+ - `validates_date` - validate value as date
93
+ - `validates_time` - validate value as time only i.e. '12:20pm'
94
+ - `validates_datetime` - validate value as a full date and time
95
+ - `validates` - use the :timeliness key and set the type in the hash.
98
96
 
99
97
  The validation methods take the usual options plus some specific ones to
100
98
  restrict the valid range of dates or times allowed
101
99
 
102
100
  Temporal options (or restrictions):
103
- :is_at - Attribute must be equal to value to be valid
104
- :before - Attribute must be before this value to be valid
105
- :on_or_before - Attribute must be equal to or before this value to be valid
106
- :after - Attribute must be after this value to be valid
107
- :on_or_after - Attribute must be equal to or after this value to be valid
108
- :between - Attribute must be between the values to be valid. Range or Array of 2 values.
101
+ - `:is_at` - Attribute must be equal to value to be valid
102
+ - `:before` - Attribute must be before this value to be valid
103
+ - `:on_or_before` - Attribute must be equal to or before this value to be valid
104
+ - `:after` - Attribute must be after this value to be valid
105
+ - `:on_or_after` - Attribute must be equal to or after this value to be valid
106
+ - `:between` - Attribute must be between the values to be valid. Range or Array of 2 values.
109
107
 
110
108
  Regular validation options:
111
- :allow_nil - Allow a nil value to be valid
112
- :allow_blank - Allows a nil or empty string value to be valid
113
- :if - Execute validation when :if evaluates true
114
- :unless - Execute validation when :unless evaluates false
115
- :on - Specify validation context e.g :save, :create or :update. Default is :save.
109
+ - `:allow_nil` - Allow a nil value to be valid
110
+ - `:allow_blank` - Allows a nil or empty string value to be valid
111
+ - `:if` - Execute validation when :if evaluates true
112
+ - `:unless` - Execute validation when :unless evaluates false
113
+ - `:on` - Specify validation context e.g :save, :create or :update. Default is :save.
116
114
 
117
115
  Special options:
118
- :ignore_usec - Ignores microsecond value on datetime restrictions
119
- :format - Limit validation to a single format for special cases. Requires plugin parser.
116
+ - `:ignore_usec` - Ignores microsecond value on datetime restrictions
117
+ - `:format` - Limit validation to a single format for special cases. Requires plugin parser.
120
118
 
121
119
  The temporal restrictions can take 4 different value types:
122
-
123
- * Date, Time, or DateTime object value
124
- * Proc or lambda object which may take an optional parameter, being the
125
- record object
126
- * A symbol matching a method name in the model
127
- * String value
120
+ - Date, Time, or DateTime object value
121
+ - Proc or lambda object which may take an optional parameter, being the record object
122
+ - A symbol matching a method name in the model
123
+ - String value
128
124
 
129
125
 
130
126
  When an attribute value is compared to temporal restrictions, they are
@@ -146,17 +142,15 @@ that the attribute is not just nil.
146
142
 
147
143
  Each ORM/ODM requires a specific shim to fix it. The plugin includes a shim
148
144
  for ActiveRecord and Mongoid. You can activate them like so
149
-
150
- ValidatesTimeliness.setup do |config|
151
-
152
- # Extend ORM/ODMs for full support (:active_record).
153
- config.extend_orms = [ :active_record ]
154
-
155
- end
145
+ ```ruby
146
+ ValidatesTimeliness.setup do |config|
147
+ # Extend ORM/ODMs for full support (:active_record).
148
+ config.extend_orms = [ :active_record ]
149
+ end
150
+ ```
156
151
 
157
152
  By default the plugin extends ActiveRecord if loaded. If you wish to extend
158
- another ORM then look at the [wiki
159
- page](https://github.com/adzap/validates_timeliness/wiki/ORM-Support) for more
153
+ another ORM then look at the [wiki page](https://github.com/adzap/validates_timeliness/wiki/ORM-Support) for more
160
154
  information.
161
155
 
162
156
  It is not required that you use a shim, but you will not catch errors when the
@@ -165,52 +159,54 @@ attribute value is invalid and evaluated to nil.
165
159
  ### Error Messages
166
160
 
167
161
  Using the I18n system to define new defaults:
168
-
169
- en:
170
- errors:
171
- messages:
172
- invalid_date: "is not a valid date"
173
- invalid_time: "is not a valid time"
174
- invalid_datetime: "is not a valid datetime"
175
- is_at: "must be at %{restriction}"
176
- before: "must be before %{restriction}"
177
- on_or_before: "must be on or before %{restriction}"
178
- after: "must be after %{restriction}"
179
- on_or_after: "must be on or after %{restriction}"
180
-
181
- The %{restriction} signifies where the interpolation value for the restriction
182
- will be inserted.
162
+ ```yml
163
+ en:
164
+ errors:
165
+ messages:
166
+ invalid_date: "is not a valid date"
167
+ invalid_time: "is not a valid time"
168
+ invalid_datetime: "is not a valid datetime"
169
+ is_at: "must be at %{restriction}"
170
+ before: "must be before %{restriction}"
171
+ on_or_before: "must be on or before %{restriction}"
172
+ after: "must be after %{restriction}"
173
+ on_or_after: "must be on or after %{restriction}"
174
+ ```
175
+
176
+ The `%{restriction}` signifies where the interpolation value for the restriction will be inserted.
183
177
 
184
178
  You can also use validation options for custom error messages. The following
185
179
  option keys are available:
186
-
187
- :invalid_date_message
188
- :invalid_time_message
189
- :invalid_datetime_message
190
- :is_at_message
191
- :before_message
192
- :on_or_before_message
193
- :after_message
194
- :on_or_after_message
195
-
196
- Note: There is no :between_message option. The between error message should be
197
- defined using the :on_or_after and :on_or_before (:before in case when
198
- :between argument is a Range with excluded high value, see Examples) messages.
199
-
200
- It is highly recommended you use the I18n system for error messages.
180
+ ```ruby
181
+ :invalid_date_message
182
+ :invalid_time_message
183
+ :invalid_datetime_message
184
+ :is_at_message
185
+ :before_message
186
+ :on_or_before_message
187
+ :after_message
188
+ :on_or_after_message
189
+ ```
190
+
191
+ **Note**: There is no `:between_message` option. The between error message should be
192
+ defined using the `:on_or_after` and `:on_or_before` (`:before` in case when
193
+ `:between` argument is a `Range` with excluded high value, see Examples) messages.
194
+
195
+ It is highly recommended you use the `I18n` system for error messages.
201
196
 
202
197
  ### Plugin Parser
203
198
 
204
199
  The plugin uses the [timeliness gem](https://github.com/adzap/timeliness) as a
205
200
  fast, configurable and extensible date and time parser. You can add or remove
206
- valid formats for dates, times, and datetimes. It is also more strict than the
201
+ valid formats for `dates`, `times`, and `datetimes`. It is also more strict than the
207
202
  Ruby parser, which means it won't accept day of the month if it's not a valid
208
203
  number for the month.
209
204
 
210
205
  By default the parser is disabled. To enable it:
211
-
212
- # in the setup block
213
- config.use_plugin_parser = true
206
+ ```ruby
207
+ # in the setup block
208
+ config.use_plugin_parser = true
209
+ ```
214
210
 
215
211
  Enabling the parser will mean that strings assigned to attributes validated
216
212
  with the plugin will be parsed using the gem. See the
@@ -226,16 +222,16 @@ validations for something so common. To combat this the plugin allows you to
226
222
  use shorthand symbols for often used relative times or dates.
227
223
 
228
224
  Just provide the symbol as the option value like so:
225
+ ```ruby
226
+ validates_date :birth_date, on_or_before: :today
227
+ ```
229
228
 
230
- validates_date :birth_date, on_or_before: :today
231
-
232
- The :today symbol is evaluated as `lambda { Date.current }`. The :now and
233
- :today symbols are pre-configured. Configure your own like so:
234
-
235
- # in the setup block
236
- config.restriction_shorthand_symbols.update(
237
- yesterday: lambda { 1.day.ago }
238
- )
229
+ The `:today` symbol is evaluated as `lambda { Date.current }`. The `:now` and
230
+ `:today` symbols are pre-configured. Configure your own like so:
231
+ ```ruby
232
+ # in the setup block
233
+ config.restriction_shorthand_symbols.update(yesterday: lambda { 1.day.ago })
234
+ ```
239
235
 
240
236
  ### Default Timezone
241
237
 
@@ -243,11 +239,12 @@ The plugin needs to know the default timezone you are using when parsing or
243
239
  type casting values. If you are using ActiveRecord then the default is
244
240
  automatically set to the same default zone as ActiveRecord. If you are using
245
241
  another ORM you may need to change this setting.
242
+ ```ruby
243
+ # in the setup block
244
+ config.default_timezone = :utc
245
+ ```
246
246
 
247
- # in the setup block
248
- config.default_timezone = :utc
249
-
250
- By default it will be UTC if ActiveRecord is not loaded.
247
+ By default it will be `UTC` if ActiveRecord is not loaded.
251
248
 
252
249
  ### Dummy Date For Time Types
253
250
 
@@ -255,13 +252,13 @@ Given that Ruby has no support for a time-only type, all time type columns are
255
252
  evaluated as a regular Time class objects with a dummy date value set. Rails
256
253
  defines the dummy date as 2000-01-01. So a time of '12:30' is evaluated as a
257
254
  Time value of '2000-01-01 12:30'. If you need to customize this for some
258
- reason you can do so as follows
259
-
260
- # in the setup block
261
- config.dummy_date_for_time_type = [2009, 1, 1]
255
+ reason you can do so as follows:
256
+ ```ruby
257
+ # in the setup block
258
+ config.dummy_date_for_time_type = [2009, 1, 1]
259
+ ```
262
260
 
263
- The value should be an array of 3 values being year, month and day in that
264
- order.
261
+ The value should be an array of 3 values being year, month and day in that order.
265
262
 
266
263
  ### Temporal Restriction Errors
267
264
 
@@ -273,9 +270,10 @@ want to skip the option if no valid value was returned. By default these
273
270
  errors are displayed in Rails test mode.
274
271
 
275
272
  To turn them on/off:
276
-
277
- # in the setup block
278
- config.ignore_restriction_errors = true
273
+ ```ruby
274
+ # in the setup block
275
+ config.ignore_restriction_errors = true
276
+ ```
279
277
 
280
278
  ## Extensions
281
279
 
@@ -288,9 +286,10 @@ treated as valid. To handle these cases in a strict way, you can enable the
288
286
  plugin extension to treat them as invalid dates.
289
287
 
290
288
  To activate it, uncomment this line in the initializer:
291
-
292
- # in the setup block
293
- config.enable_multiparameter_extension!
289
+ ```ruby
290
+ # in the setup block
291
+ config.enable_multiparameter_extension!
292
+ ```
294
293
 
295
294
  ### Display Invalid Values in Select Helpers
296
295
 
@@ -301,21 +300,20 @@ pretty rare occurrence, given the select dropdowns for each date/time
301
300
  component, but it may be something of interest.
302
301
 
303
302
  To activate it, uncomment this line in the initializer:
304
-
305
- # in the setup block
306
- config.enable_date_time_select_extension!
303
+ ```ruby
304
+ # in the setup block
305
+ config.enable_date_time_select_extension!
306
+ ```
307
307
 
308
308
  ## Contributors
309
309
 
310
310
  To see the generous people who have contributed code, take a look at the
311
- [contributors
312
- list](https://github.com/adzap/validates_timeliness/contributors).
311
+ [contributors list](https://github.com/adzap/validates_timeliness/contributors).
313
312
 
314
313
  ## Maintainers
315
314
 
316
- * [Adam Meehan](https://github.com/adzap)
317
-
315
+ * [Adam Meehan](https://github.com/adzap)
318
316
 
319
317
  ## License
320
318
 
321
- Copyright (c) 2008 Adam Meehan, released under the MIT license
319
+ Copyright (c) 2021 Adam Meehan, released under the MIT license.
@@ -2,11 +2,10 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "~> 6.0.0"
5
+ gem "rails", "~> 7.0.0"
6
6
  gem "rspec"
7
- gem "rspec-rails", "~> 3.7"
7
+ gem "rspec-rails", "~> 6.0"
8
8
  gem "sqlite3"
9
- gem "timecop"
10
9
  gem "byebug"
11
10
  gem "appraisal"
12
11
  gem "nokogiri", "~> 1.8"
@@ -6,7 +6,6 @@ gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
6
6
  gem "rspec"
7
7
  gem "rspec-rails", "~> 3.7"
8
8
  gem "sqlite3"
9
- gem "timecop"
10
9
  gem "byebug"
11
10
  gem "appraisal"
12
11
  gem "nokogiri", "~> 1.8"
@@ -2,7 +2,7 @@ module ValidatesTimeliness
2
2
  class Railtie < Rails::Railtie
3
3
  initializer "validates_timeliness.initialize_active_record", :after => 'active_record.initialize_timezone' do
4
4
  ActiveSupport.on_load(:active_record) do
5
- ValidatesTimeliness.default_timezone = ActiveRecord::Base.default_timezone
5
+ ValidatesTimeliness.default_timezone = ActiveRecord.default_timezone
6
6
  ValidatesTimeliness.extend_orms << :active_record
7
7
  ValidatesTimeliness.load_orms
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module ValidatesTimeliness
2
- VERSION = '6.0.0.beta2'
2
+ VERSION = '7.0.0.beta1'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,7 @@ require 'active_model'
5
5
  require 'active_model/validations'
6
6
  require 'active_record'
7
7
  require 'action_view'
8
- require 'timecop'
8
+ require 'active_support/testing/time_helpers'
9
9
 
10
10
  require 'validates_timeliness'
11
11
  require 'validates_timeliness/orm/active_model'
@@ -57,7 +57,7 @@ class PersonWithShim < Person
57
57
  include TestModelShim
58
58
  end
59
59
 
60
- ActiveRecord::Base.default_timezone = :utc
60
+ ActiveRecord.default_timezone = :utc
61
61
  ActiveRecord::Base.time_zone_aware_attributes = true
62
62
  ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', :database => ':memory:'})
63
63
  ActiveRecord::Base.time_zone_aware_types = [:datetime, :time]
@@ -89,6 +89,7 @@ RSpec.configure do |c|
89
89
  c.include(TagMatcher)
90
90
  c.include(ModelHelpers)
91
91
  c.include(ConfigHelper)
92
+ c.include(ActiveSupport::Testing::TimeHelpers)
92
93
  c.before do
93
94
  reset_validation_setup_for(Person)
94
95
  reset_validation_setup_for(PersonWithShim)
@@ -7,7 +7,11 @@ RSpec.describe ValidatesTimeliness::Converter do
7
7
  let(:ignore_usec) { false }
8
8
 
9
9
  before do
10
- Timecop.freeze(Time.mktime(2010, 1, 1, 0, 0, 0))
10
+ travel_to Time.mktime(2010, 1, 1, 0, 0, 0)
11
+ end
12
+
13
+ after do
14
+ travel_back
11
15
  end
12
16
 
13
17
  delegate :type_cast_value, :evaluate, :parse, :dummy_time, to: :converter
@@ -195,10 +199,6 @@ RSpec.describe ValidatesTimeliness::Converter do
195
199
  end
196
200
 
197
201
  context "restriction shorthand" do
198
- before do
199
- Timecop.freeze(Time.mktime(2010, 1, 1, 0, 0, 0))
200
- end
201
-
202
202
  it 'should evaluate :now as current time' do
203
203
  expect(evaluate(:now, person)).to eq(Time.now)
204
204
  end
@@ -115,7 +115,11 @@ RSpec.describe 'ValidatesTimeliness::Extensions::DateTimeSelect' do
115
115
 
116
116
  describe "time_select" do
117
117
  before do
118
- Timecop.freeze Time.mktime(2009,1,1)
118
+ travel_to Time.mktime(2009,1,1)
119
+ end
120
+
121
+ after do
122
+ travel_back
119
123
  end
120
124
 
121
125
  it "should use param values when attribute is nil" do
@@ -158,5 +162,5 @@ RSpec.describe 'ValidatesTimeliness::Extensions::DateTimeSelect' do
158
162
  expect(@output).not_to have_tag("select[id=person_#{attribute}_#{index}i] option[selected=selected]")
159
163
  end
160
164
  end
161
-
165
+
162
166
  end
@@ -1,6 +1,10 @@
1
1
  RSpec.describe ValidatesTimeliness::Validator, ":is_at option" do
2
2
  before do
3
- Timecop.freeze(Time.local(2010, 1, 1, 0, 0, 0))
3
+ travel_to Time.local(2010, 1, 1, 0, 0, 0)
4
+ end
5
+
6
+ after do
7
+ travel_back
4
8
  end
5
9
 
6
10
  describe "for date type" do
@@ -1,6 +1,10 @@
1
1
  RSpec.describe ValidatesTimeliness::Validator do
2
2
  before do
3
- Timecop.freeze(Time.local(2010, 1, 1, 0, 0, 0))
3
+ travel_to Time.local(2010, 1, 1, 0, 0, 0)
4
+ end
5
+
6
+ after do
7
+ travel_back
4
8
  end
5
9
 
6
10
  describe "Model.validates with :timeliness option" do
@@ -3,20 +3,30 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
  require "validates_timeliness/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
+
7
+ github_url = 'https://github.com/adzap/validates_timeliness'
8
+
6
9
  s.name = "validates_timeliness"
7
10
  s.version = ValidatesTimeliness::VERSION
8
11
  s.authors = ["Adam Meehan"]
9
12
  s.summary = %q{Date and time validation plugin for Rails which allows custom formats}
10
13
  s.description = %q{Adds validation methods to ActiveModel for validating dates and times. Works with multiple ORMS.}
11
14
  s.email = %q{adam.meehan@gmail.com}
12
- s.homepage = %q{http://github.com/adzap/validates_timeliness}
15
+ s.homepage = github_url
13
16
  s.license = "MIT"
14
17
 
15
18
  s.require_paths = ["lib"]
16
19
  s.files = `git ls-files`.split("\n") - %w{ .gitignore .rspec Gemfile Gemfile.lock autotest/discover.rb Appraisals } - Dir['gemsfiles/*']
17
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.extra_rdoc_files = ["README.md", "CHANGELOG.rdoc", "LICENSE"]
21
+ s.extra_rdoc_files = ["README.md", "CHANGELOG.md", "LICENSE"]
22
+
23
+ s.metadata = {
24
+ "bug_tracker_uri" => "#{github_url}/issues",
25
+ "changelog_uri" => "#{github_url}/blob/master/CHANGELOG.md",
26
+ "source_code_uri" => "#{github_url}",
27
+ "wiki_uri" => "#{github_url}/wiki",
28
+ }
19
29
 
20
- s.add_runtime_dependency("activemodel", [">= 6.0.0", "< 7"])
30
+ s.add_runtime_dependency("activemodel", [">= 7.0.0", "< 8"])
21
31
  s.add_runtime_dependency("timeliness", [">= 0.3.10", "< 1"])
22
32
  end