validates_timeliness 5.0.0.alpha4 → 5.0.0.alpha5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +7 -0
- data/README.rdoc +1 -1
- 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/validates_timeliness/railtie_spec.rb +22 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c8e4da95b2742cd11181d664cb5c5d7c2e6f69764641e72c0c9ad244196529f
|
4
|
+
data.tar.gz: 8b6e1cdcecb56aa889baaf0e0a874a53bedc940656757f52526f3f2eeac0e0fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e4510dd3f118be6b9cda10aab0ce0bbc81a30886f269a7ac90f0328223d8a857b86ce24d79afb400df793482f0336f4704d68736ef49f640ef260c7f358b578
|
7
|
+
data.tar.gz: 59e81dfef384de7707585e2378d1b8f23cd557e9acab2f6a22f6c92d9c3032856620644daf0f42a163c9a9de7d58e944589e15fd37f6c81c7f7a410d6221fd74
|
data/CHANGELOG.rdoc
CHANGED
@@ -3,12 +3,19 @@
|
|
3
3
|
* Relaxed Timeliness dependency version which allows for >= 0.4.0 with
|
4
4
|
threadsafety fix for use_us_formats and use_euro_formats for hot switching
|
5
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'.
|
6
8
|
|
7
9
|
Breaking Changes
|
8
10
|
* Update Multiparameter extension to use ActiveRecord type classes with multiparameter handling
|
9
11
|
which stores a hash of multiparamter values as the value before type cast, no longer a mushed datetime string
|
10
12
|
* Removed all custom plugin attribute methods and method overrides in favour using ActiveModel type system
|
11
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
|
+
|
12
19
|
= 4.0.2 [2016-01-07]
|
13
20
|
* Fix undefine_generated_methods ivar guard setting to false
|
14
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
|
|
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
@@ -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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.alpha5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Meehan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: timeliness
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- spec/validates_timeliness/extensions/multiparameter_handler_spec.rb
|
76
76
|
- spec/validates_timeliness/helper_methods_spec.rb
|
77
77
|
- spec/validates_timeliness/orm/active_record_spec.rb
|
78
|
+
- spec/validates_timeliness/railtie_spec.rb
|
78
79
|
- spec/validates_timeliness/validator/after_spec.rb
|
79
80
|
- spec/validates_timeliness/validator/before_spec.rb
|
80
81
|
- spec/validates_timeliness/validator/is_at_spec.rb
|
@@ -103,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
104
|
version: 1.3.1
|
104
105
|
requirements: []
|
105
106
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.7.6
|
107
|
+
rubygems_version: 2.7.6.2
|
107
108
|
signing_key:
|
108
109
|
specification_version: 4
|
109
110
|
summary: Date and time validation plugin for Rails which allows custom formats
|
@@ -119,6 +120,7 @@ test_files:
|
|
119
120
|
- spec/validates_timeliness/extensions/multiparameter_handler_spec.rb
|
120
121
|
- spec/validates_timeliness/helper_methods_spec.rb
|
121
122
|
- spec/validates_timeliness/orm/active_record_spec.rb
|
123
|
+
- spec/validates_timeliness/railtie_spec.rb
|
122
124
|
- spec/validates_timeliness/validator/after_spec.rb
|
123
125
|
- spec/validates_timeliness/validator/before_spec.rb
|
124
126
|
- spec/validates_timeliness/validator/is_at_spec.rb
|