validates_timeliness 5.0.0.alpha2 → 5.0.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.rdoc +10 -0
- data/README.rdoc +2 -2
- data/gemfiles/rails_5_0.gemfile +1 -5
- data/gemfiles/rails_5_1.gemfile +1 -5
- data/gemfiles/rails_5_2.gemfile +1 -5
- data/lib/validates_timeliness.rb +2 -2
- data/lib/validates_timeliness/orm/active_record.rb +1 -1
- data/lib/validates_timeliness/railtie.rb +8 -0
- data/lib/validates_timeliness/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/support/model_helpers.rb +1 -2
- data/spec/validates_timeliness/railtie_spec.rb +22 -0
- data/validates_timeliness.gemspec +1 -1
- metadata +18 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1a33066804513d38555d4df30d3dfbad7014c62d8957ad1ebf99c14adb90beb
|
4
|
+
data.tar.gz: 56761810344acb7c8ff581e255ba552d0068aef5502fd273738f63c0210e6072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2301742287dd48a2736f3e0d5d0c53668a24dbefbec14fe6634a30ea6623ec1b8f444585fef45f641cdc0796f505ca83dc491d7e325d99e9168591b2b1a36566
|
7
|
+
data.tar.gz: 452facc79441af9ec3baad06ab9cd4d2d0a0e1df3e4977200db615e949fcad117b91661641230137422d28483cc8bb48d4580eec4dce90a0c41a16e81ab82ee0
|
data/.travis.yml
CHANGED
data/CHANGELOG.rdoc
CHANGED
@@ -1,11 +1,21 @@
|
|
1
1
|
= [UNRELEASED]
|
2
2
|
* Fix DateTimeSelect extension support (AquisTech)
|
3
|
+
* Relaxed Timeliness dependency version which allows for >= 0.4.0 with
|
4
|
+
threadsafety fix for use_us_formats and use_euro_formats for hot switching
|
5
|
+
in a request.
|
6
|
+
* Add initializer to ensure Timeliness v0.4+ ambiguous date config is set
|
7
|
+
correctly when using `use_euro_formats` or `remove_use_formats'.
|
3
8
|
|
4
9
|
Breaking Changes
|
5
10
|
* Update Multiparameter extension to use ActiveRecord type classes with multiparameter handling
|
6
11
|
which stores a hash of multiparamter values as the value before type cast, no longer a mushed datetime string
|
7
12
|
* Removed all custom plugin attribute methods and method overrides in favour using ActiveModel type system
|
8
13
|
|
14
|
+
= 4.1.0 [2019-06-11]
|
15
|
+
* Relaxed Timeliness dependency version to >= 0.3.10 and < 1, which allows
|
16
|
+
version 0.4 with threadsafety fix for use_us_formats and use_euro_formats
|
17
|
+
hot switching in a request.
|
18
|
+
|
9
19
|
= 4.0.2 [2016-01-07]
|
10
20
|
* Fix undefine_generated_methods ivar guard setting to false
|
11
21
|
|
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
== Description
|
7
7
|
|
8
|
-
Complete validation of dates, times and datetimes for Rails 5.
|
8
|
+
Complete validation of dates, times and datetimes for Rails 5.x and ActiveModel.
|
9
9
|
|
10
10
|
If you a looking for the old version for Rails 4.x go here [https://github.com/adzap/validates_timeliness/tree/4-0-stable].
|
11
11
|
|
@@ -30,7 +30,7 @@ If you a looking for the old version for Rails 4.x go here [https://github.com/a
|
|
30
30
|
== Installation
|
31
31
|
|
32
32
|
# in Gemfile
|
33
|
-
gem 'validates_timeliness', '~> 5.0.0.
|
33
|
+
gem 'validates_timeliness', '~> 5.0.0.beta1'
|
34
34
|
|
35
35
|
# Run bundler
|
36
36
|
$ bundle install
|
data/gemfiles/rails_5_0.gemfile
CHANGED
@@ -8,11 +8,7 @@ gem "rspec-rails", "~> 3.7"
|
|
8
8
|
gem "timecop"
|
9
9
|
gem "byebug"
|
10
10
|
gem "appraisal"
|
11
|
-
gem "sqlite3"
|
11
|
+
gem "sqlite3", "~> 1.3.6"
|
12
12
|
gem "nokogiri", "~> 1.8"
|
13
13
|
|
14
|
-
group :active_record do
|
15
|
-
gem "sqlite3-ruby", require: "sqlite3"
|
16
|
-
end
|
17
|
-
|
18
14
|
gemspec path: "../"
|
data/gemfiles/rails_5_1.gemfile
CHANGED
@@ -8,11 +8,7 @@ gem "rspec-rails", "~> 3.7"
|
|
8
8
|
gem "timecop"
|
9
9
|
gem "byebug"
|
10
10
|
gem "appraisal"
|
11
|
-
gem "sqlite3"
|
11
|
+
gem "sqlite3", "~> 1.3.6"
|
12
12
|
gem "nokogiri", "~> 1.8"
|
13
13
|
|
14
|
-
group :active_record do
|
15
|
-
gem "sqlite3-ruby", require: "sqlite3"
|
16
|
-
end
|
17
|
-
|
18
14
|
gemspec path: "../"
|
data/gemfiles/rails_5_2.gemfile
CHANGED
@@ -8,11 +8,7 @@ gem "rspec-rails", "~> 3.7"
|
|
8
8
|
gem "timecop"
|
9
9
|
gem "byebug"
|
10
10
|
gem "appraisal"
|
11
|
-
gem "sqlite3"
|
11
|
+
gem "sqlite3", "~> 1.3.6"
|
12
12
|
gem "nokogiri", "~> 1.8"
|
13
13
|
|
14
|
-
group :active_record do
|
15
|
-
gem "sqlite3-ruby", require: "sqlite3"
|
16
|
-
end
|
17
|
-
|
18
14
|
gemspec path: "../"
|
data/lib/validates_timeliness.rb
CHANGED
@@ -36,8 +36,8 @@ module ValidatesTimeliness
|
|
36
36
|
|
37
37
|
# Shorthand time and date symbols for restrictions
|
38
38
|
self.restriction_shorthand_symbols = {
|
39
|
-
:
|
40
|
-
:
|
39
|
+
now: proc { Time.current },
|
40
|
+
today: proc { Date.current }
|
41
41
|
}
|
42
42
|
|
43
43
|
# Use the plugin date/time parser which is stricter and extensible
|
@@ -11,5 +11,13 @@ module ValidatesTimeliness
|
|
11
11
|
initializer "validates_timeliness.initialize_restriction_errors" do
|
12
12
|
ValidatesTimeliness.ignore_restriction_errors = !Rails.env.test?
|
13
13
|
end
|
14
|
+
|
15
|
+
initializer "validates_timeliness.initialize_timeliness_ambiguous_date_format", :after => :load_config_initializers do
|
16
|
+
if Timeliness.respond_to?(:ambiguous_date_format) # i.e. v0.4+
|
17
|
+
# Set default for each new thread if you have changed the default using
|
18
|
+
# the format switching methods.
|
19
|
+
Timeliness.configuration.ambiguous_date_format = Timeliness::Definitions.current_date_format
|
20
|
+
end
|
21
|
+
end
|
14
22
|
end
|
15
23
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,8 +17,7 @@ module ModelHelpers
|
|
17
17
|
|
18
18
|
def with_each_person_value(attr_name, values)
|
19
19
|
record = Person.new
|
20
|
-
values
|
21
|
-
values.each do |value|
|
20
|
+
Array.wrap(values).each do |value|
|
22
21
|
record.send("#{attr_name}=", value)
|
23
22
|
yield record, value
|
24
23
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'validates_timeliness/railtie'
|
2
|
+
|
3
|
+
RSpec.describe ValidatesTimeliness::Railtie do
|
4
|
+
context "intializers" do
|
5
|
+
context "validates_timeliness.initialize_timeliness_ambiguous_date_format" do
|
6
|
+
it 'should set the timeliness default ambiguous date format from the current format' do
|
7
|
+
expect(Timeliness.configuration.ambiguous_date_format).to eq :us
|
8
|
+
ValidatesTimeliness.parser.use_euro_formats
|
9
|
+
|
10
|
+
initializer("validates_timeliness.initialize_timeliness_ambiguous_date_format").run
|
11
|
+
|
12
|
+
expect(Timeliness.configuration.ambiguous_date_format).to eq :euro
|
13
|
+
end
|
14
|
+
end if Timeliness.respond_to?(:ambiguous_date_format)
|
15
|
+
|
16
|
+
def initializer(name)
|
17
|
+
ValidatesTimeliness::Railtie.initializers.find { |i|
|
18
|
+
i.name == name
|
19
|
+
} || raise("Initializer #{name} not found")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "LICENSE"]
|
19
19
|
|
20
|
-
s.add_runtime_dependency(%q<timeliness>, ["
|
20
|
+
s.add_runtime_dependency(%q<timeliness>, [">= 0.3.10", "< 1"])
|
21
21
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_timeliness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Meehan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: timeliness
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.3.
|
19
|
+
version: 0.3.10
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.3.10
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: '1'
|
27
33
|
description: Adds validation methods to ActiveModel for validating dates and times.
|
28
34
|
Works with multiple ORMS.
|
29
35
|
email: adam.meehan@gmail.com
|
@@ -69,6 +75,7 @@ files:
|
|
69
75
|
- spec/validates_timeliness/extensions/multiparameter_handler_spec.rb
|
70
76
|
- spec/validates_timeliness/helper_methods_spec.rb
|
71
77
|
- spec/validates_timeliness/orm/active_record_spec.rb
|
78
|
+
- spec/validates_timeliness/railtie_spec.rb
|
72
79
|
- spec/validates_timeliness/validator/after_spec.rb
|
73
80
|
- spec/validates_timeliness/validator/before_spec.rb
|
74
81
|
- spec/validates_timeliness/validator/is_at_spec.rb
|
@@ -81,7 +88,7 @@ homepage: http://github.com/adzap/validates_timeliness
|
|
81
88
|
licenses:
|
82
89
|
- MIT
|
83
90
|
metadata: {}
|
84
|
-
post_install_message:
|
91
|
+
post_install_message:
|
85
92
|
rdoc_options: []
|
86
93
|
require_paths:
|
87
94
|
- lib
|
@@ -96,9 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
103
|
- !ruby/object:Gem::Version
|
97
104
|
version: 1.3.1
|
98
105
|
requirements: []
|
99
|
-
|
100
|
-
|
101
|
-
signing_key:
|
106
|
+
rubygems_version: 3.0.3
|
107
|
+
signing_key:
|
102
108
|
specification_version: 4
|
103
109
|
summary: Date and time validation plugin for Rails which allows custom formats
|
104
110
|
test_files:
|
@@ -113,6 +119,7 @@ test_files:
|
|
113
119
|
- spec/validates_timeliness/extensions/multiparameter_handler_spec.rb
|
114
120
|
- spec/validates_timeliness/helper_methods_spec.rb
|
115
121
|
- spec/validates_timeliness/orm/active_record_spec.rb
|
122
|
+
- spec/validates_timeliness/railtie_spec.rb
|
116
123
|
- spec/validates_timeliness/validator/after_spec.rb
|
117
124
|
- spec/validates_timeliness/validator/before_spec.rb
|
118
125
|
- spec/validates_timeliness/validator/is_at_spec.rb
|