validates_timeliness 4.0.2 → 4.1.0

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
- SHA1:
3
- metadata.gz: e6948ef97991bd753c5068558b501fc32172fc4e
4
- data.tar.gz: 96f2c3ac36e68e13a3f945125a71313a04f751c1
2
+ SHA256:
3
+ metadata.gz: 148ec0229512f4f5dd6ab3b7eeb0afe75551db13cc7d905d49d3f2caf31e54b1
4
+ data.tar.gz: d87f86e30c3e580c3fe568681d8815c87fc023acd6a5adc4cff79e448b2bafa0
5
5
  SHA512:
6
- metadata.gz: 05647d243bda685e49806640732a14a0e76f8ebf4c2c9f6be515a6d231c7a6fb45c46d3babd9cd2bae00e243f1e49d701f1cf47694ccdb3f89bde71216360e2e
7
- data.tar.gz: 6dcc4874db66f1b06439117c3c3d32763a5ae969a06ad429e2df6b74978a201ffb5a2ad308a84a041e15637c22ec27c724ce500c2e2ff5af4a0561c122faf03b
6
+ metadata.gz: 37e10a32e376ece6501a9e3148ead0aa3e2951c2a29791d75984b265c297ceaf0668bfad1a6e8d3771996393356137e2137bc86efac1f8a4b8822bc3a3f58510
7
+ data.tar.gz: 241e9aff31988c0d27c584d79355b8b5346c691312f907d0ec3845933f14a9847490af64b7c8bb5cbc7caad17778877f420330d4ff572612d96c208825a6ce3e
@@ -1,16 +1,26 @@
1
1
  language: ruby
2
+ before_install:
3
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
4
+ - gem install bundler -v '< 2'
5
+ before_script:
6
+ - bundle install
2
7
  cache: bundler
8
+ bundler_args: --verbose
3
9
 
4
- gemfile:
5
- - gemfiles/rails_4_0.gemfile
6
- - gemfiles/rails_4_1.gemfile
7
- - gemfiles/rails_4_2.gemfile
10
+ matrix:
11
+ include:
12
+ - rvm: "2.3.7"
13
+ gemfile: gemfiles/rails_4_0.gemfile
14
+ - rvm: "2.3.7"
15
+ gemfile: gemfiles/rails_4_1.gemfile
16
+ - rvm: "2.3.7"
17
+ gemfile: gemfiles/rails_4_2.gemfile
18
+ - rvm: "2.4.6"
19
+ gemfile: gemfiles/rails_4_2.gemfile
20
+ - rvm: "2.5.5"
21
+ gemfile: gemfiles/rails_4_2.gemfile
8
22
 
9
- rvm:
10
- - "2.2.3"
11
- - "2.3.0"
12
-
13
- script: 'bundle exec rake'
23
+ script: 'bundle exec rspec'
14
24
 
15
25
  notifications:
16
26
  email:
@@ -1,3 +1,15 @@
1
+ = 4.1.0 [2019-06-11]
2
+ * Relaxed Timeliness dependency version to >= 0.3.10 and < 1, which allows
3
+ version 0.4 with threadsafety fix for use_us_formats and use_euro_formats
4
+ hot switching in a request.
5
+
6
+ = 4.0.2 [2016-01-07]
7
+ * Fix undefine_generated_methods ivar guard setting to false
8
+
9
+ = 4.0.1 [2016-01-06]
10
+ * Fix undefine_generated_methods thread locking bug
11
+ * Created an ActiveModel ORM, for manual require if using without any full blown ORM
12
+
1
13
  = 4.0.0 [2015-12-29]
2
14
  * Extracted mongoid support into https://github.com/adzap/validates_timeliness-mongoid which is broken (not supported anymore).
3
15
  * Fixed Rails 4.0, 4.1 and 4.2 compatability issues
@@ -22,7 +22,7 @@ If you a looking for the old version for Rails 3.x go here[http://github.com/adz
22
22
 
23
23
  * Adds extensions to fix Rails date/time select issues (See Extensions)
24
24
 
25
- * Supports I18n for the error messages
25
+ * Supports I18n for the error messages. For multi-language support try {timeliness-i18n gem}[https://github.com/pedrofurtado/timeliness-i18n].
26
26
 
27
27
  * Supports all the Rubies (that any sane person would be using in production).
28
28
 
@@ -1,19 +1,14 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "http://rubygems.org"
3
+ source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 4.0.0"
6
- gem "rspec", "~> 3.0.0"
7
- gem "rspec-rails", "~> 3.0.0"
5
+ gem "rails", "~> 4.0.13"
6
+ gem "rspec", "~> 3.6.0"
7
+ gem "rspec-rails", "~> 3.6.0"
8
8
  gem "timecop"
9
- gem "rspec_tag_matchers"
10
9
  gem "byebug"
11
10
  gem "appraisal"
12
- gem "sqlite3"
11
+ gem "sqlite3", "~> 1.3.0"
13
12
  gem "nokogiri", "1.6.7"
14
13
 
15
- group :active_record do
16
- gem "sqlite3-ruby", :require => "sqlite3"
17
- end
18
-
19
- gemspec :path => "../"
14
+ gemspec path: "../"
@@ -1,19 +1,14 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "http://rubygems.org"
3
+ source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 4.1.0"
6
- gem "rspec", "~> 3.0.0"
7
- gem "rspec-rails", "~> 3.0.0"
5
+ gem "rails", "~> 4.1.14"
6
+ gem "rspec", "~> 3.6.0"
7
+ gem "rspec-rails", "~> 3.6.0"
8
8
  gem "timecop"
9
- gem "rspec_tag_matchers"
10
9
  gem "byebug"
11
10
  gem "appraisal"
12
- gem "sqlite3"
11
+ gem "sqlite3", "~> 1.3.0"
13
12
  gem "nokogiri", "1.6.7"
14
13
 
15
- group :active_record do
16
- gem "sqlite3-ruby", :require => "sqlite3"
17
- end
18
-
19
- gemspec :path => "../"
14
+ gemspec path: "../"
@@ -1,19 +1,14 @@
1
1
  # This file was generated by Appraisal
2
2
 
3
- source "http://rubygems.org"
3
+ source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 4.2.0"
6
- gem "rspec", "~> 3.0.0"
7
- gem "rspec-rails", "~> 3.0.0"
5
+ gem "rails", "~> 4.2.8"
6
+ gem "rspec", "~> 3.6.0"
7
+ gem "rspec-rails", "~> 3.6.0"
8
8
  gem "timecop"
9
- gem "rspec_tag_matchers"
10
9
  gem "byebug"
11
10
  gem "appraisal"
12
- gem "sqlite3"
11
+ gem "sqlite3", "~> 1.3.0"
13
12
  gem "nokogiri", "1.6.7"
14
13
 
15
- group :active_record do
16
- gem "sqlite3-ruby", :require => "sqlite3"
17
- end
18
-
19
- gemspec :path => "../"
14
+ gemspec path: "../"
@@ -56,7 +56,7 @@ module ValidatesTimeliness
56
56
  end
57
57
 
58
58
  # Rails 4.0 compatibility for old #setup method with class as arg
59
- if ActiveModel.version <= Gem::Version.new('4.1')
59
+ if Gem::Version.new(ActiveModel::VERSION::STRING) <= Gem::Version.new('4.1')
60
60
  alias_method(:setup, :setup_timeliness_validated_attributes)
61
61
  end
62
62
 
@@ -91,7 +91,7 @@ module ValidatesTimeliness
91
91
 
92
92
  def add_error(record, attr_name, message, value=nil)
93
93
  value = format_error_value(value) if value
94
- message_options = { :message => options[:"#{message}_message"], :restriction => value }
94
+ message_options = { :message => options.fetch(:"#{message}_message", options[:message]), :restriction => value }
95
95
  record.errors.add(attr_name, message, message_options)
96
96
  end
97
97
 
@@ -1,3 +1,3 @@
1
1
  module ValidatesTimeliness
2
- VERSION = '4.0.2'
2
+ VERSION = '4.1.0'
3
3
  end
@@ -71,8 +71,8 @@ end
71
71
  class Employee < ActiveRecord::Base
72
72
  attr_accessor :redefined_birth_date_called
73
73
  validates_date :birth_date, :allow_nil => true
74
- validates_date :birth_time, :allow_nil => true
75
- validates_date :birth_datetime, :allow_nil => true
74
+ validates_time :birth_time, :allow_nil => true
75
+ validates_datetime :birth_datetime, :allow_nil => true
76
76
 
77
77
  def birth_date=(value)
78
78
  self.redefined_birth_date_called = true
@@ -241,8 +241,14 @@ RSpec.describe ValidatesTimeliness, 'ActiveRecord' do
241
241
  end
242
242
 
243
243
  context "undefine_attribute_methods" do
244
- it "returns a falsy value if the attribute methods have already been generated" do
245
- expect { Employee.undefine_attribute_methods }.to_not raise_error
244
+ it "returns remove attribute methods that have already been generated" do
245
+ Employee.define_attribute_methods
246
+
247
+ expect(Employee.instance_methods).to include(:birth_datetime)
248
+
249
+ Employee.undefine_attribute_methods
250
+
251
+ expect(Employee.instance_methods).to_not include(:birth_datetime)
246
252
  end
247
253
  end
248
254
  end
@@ -87,6 +87,20 @@ RSpec.describe ValidatesTimeliness::Validator do
87
87
  end
88
88
  end
89
89
 
90
+ describe ':message options' do
91
+ it 'should allow message option too' do
92
+ Person.validates_date :birth_date, on_or_after: :today, message: 'cannot be in past'
93
+ invalid!(:birth_date, Date.today - 5.days, 'cannot be in past')
94
+ valid!(:birth_date, Date.today)
95
+ end
96
+
97
+ it 'should first allow the defined message' do
98
+ Person.validates_date :birth_date, on_or_after: :today, on_or_after_message: 'cannot be in past', message: 'dummy message'
99
+ invalid!(:birth_date, Date.today - 5.days, 'cannot be in past')
100
+ valid!(:birth_date, Date.today)
101
+ end
102
+ end
103
+
90
104
  describe ":between option" do
91
105
  describe "array value" do
92
106
  it 'should be split option into :on_or_after and :on_or_before values' do
@@ -10,11 +10,12 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{Adds validation methods to ActiveModel for validating dates and times. Works with multiple ORMS.}
11
11
  s.email = %q{adam.meehan@gmail.com}
12
12
  s.homepage = %q{http://github.com/adzap/validates_timeliness}
13
+ s.license = "MIT"
13
14
 
14
15
  s.require_paths = ["lib"]
15
16
  s.files = `git ls-files`.split("\n") - %w{ .gitignore .rspec Gemfile Gemfile.lock autotest/discover.rb Appraisals Travis.yml } - Dir['gemsfiles/*']
16
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
18
  s.extra_rdoc_files = ["README.rdoc", "CHANGELOG.rdoc", "LICENSE"]
18
19
 
19
- s.add_runtime_dependency(%q<timeliness>, ["~> 0.3.7"])
20
+ s.add_runtime_dependency(%q<timeliness>, [">= 0.3.10", "< 1"])
20
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: 4.0.2
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Meehan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-06 00:00:00.000000000 Z
11
+ date: 2019-06-11 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.7
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.7
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
@@ -78,7 +84,8 @@ files:
78
84
  - spec/validates_timeliness_spec.rb
79
85
  - validates_timeliness.gemspec
80
86
  homepage: http://github.com/adzap/validates_timeliness
81
- licenses: []
87
+ licenses:
88
+ - MIT
82
89
  metadata: {}
83
90
  post_install_message:
84
91
  rdoc_options: []
@@ -96,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
103
  version: '0'
97
104
  requirements: []
98
105
  rubyforge_project:
99
- rubygems_version: 2.4.5
106
+ rubygems_version: 2.7.6.2
100
107
  signing_key:
101
108
  specification_version: 4
102
109
  summary: Date and time validation plugin for Rails which allows custom formats