validates_timeliness 5.0.0.alpha2 → 5.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5866702e0869b2d7f93449cb58dc8db475a458cf0b6f90b3c2bb4b486e045ab
4
- data.tar.gz: a5c597d6afefa7e48d83a4eb3582581201452912601fa040a6bc6fe62469748e
3
+ metadata.gz: a1a33066804513d38555d4df30d3dfbad7014c62d8957ad1ebf99c14adb90beb
4
+ data.tar.gz: 56761810344acb7c8ff581e255ba552d0068aef5502fd273738f63c0210e6072
5
5
  SHA512:
6
- metadata.gz: 725bc85ef17857f8ae9df14f84f5255fe2fcb2d84d71db804f69957fc5a6eca504412af2401c49f07545d160e06036b2b29392ddf3cb89d87bb9db2ae49e49ac
7
- data.tar.gz: 02a37feefa774fbd7444ad77eee49fdffe8bbff075f6134b64e9611ca10d447f4ad9474c6ee5eba20016ef05a70a9170b10d325861181b7e9282559b2bc4d5b2
6
+ metadata.gz: 2301742287dd48a2736f3e0d5d0c53668a24dbefbec14fe6634a30ea6623ec1b8f444585fef45f641cdc0796f505ca83dc491d7e325d99e9168591b2b1a36566
7
+ data.tar.gz: 452facc79441af9ec3baad06ab9cd4d2d0a0e1df3e4977200db615e949fcad117b91661641230137422d28483cc8bb48d4580eec4dce90a0c41a16e81ab82ee0
@@ -8,7 +8,7 @@ gemfile:
8
8
  - gemfiles/rails_5_2.gemfile
9
9
 
10
10
  rvm:
11
- - "2.5.1"
11
+ - "2.5.3"
12
12
 
13
13
  script: 'bundle exec rspec'
14
14
 
@@ -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
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  == Description
7
7
 
8
- Complete validation of dates, times and datetimes for Rails 5.0.x and ActiveModel.
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.alpha2'
33
+ gem 'validates_timeliness', '~> 5.0.0.beta1'
34
34
 
35
35
  # Run bundler
36
36
  $ bundle install
@@ -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: "../"
@@ -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: "../"
@@ -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: "../"
@@ -36,8 +36,8 @@ module ValidatesTimeliness
36
36
 
37
37
  # Shorthand time and date symbols for restrictions
38
38
  self.restriction_shorthand_symbols = {
39
- :now => lambda { Time.current },
40
- :today => lambda { Date.current }
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,7 +11,7 @@ module ValidatesTimeliness
11
11
  end
12
12
  end
13
13
 
14
- class ActiveRecord::Base
14
+ ActiveSupport.on_load(:active_record) do
15
15
  include ValidatesTimeliness::AttributeMethods
16
16
  include ValidatesTimeliness::ORM::ActiveRecord
17
17
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ValidatesTimeliness
2
- VERSION = '5.0.0.alpha2'
2
+ VERSION = '5.0.0.beta2'
3
3
  end
@@ -10,6 +10,8 @@ require 'timecop'
10
10
  require 'validates_timeliness'
11
11
  require 'validates_timeliness/orm/active_model'
12
12
 
13
+ require 'rails/railtie'
14
+
13
15
  require 'support/test_model'
14
16
  require 'support/model_helpers'
15
17
  require 'support/config_helper'
@@ -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 = [values] unless values.is_a?(Array)
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>, ["~> 0.3.8"])
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.alpha2
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: 2018-07-02 00:00:00.000000000 Z
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.8
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: 0.3.8
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
- rubyforge_project:
100
- rubygems_version: 2.7.3
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