date_validator 0.7.1 → 0.8.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
2
  SHA1:
3
- metadata.gz: 10530abca992905ef4966abc59bde16277badc80
4
- data.tar.gz: ec91b26e1d5c4ec2f2a021da33b785e4c60d5371
3
+ metadata.gz: 5f8f859465fc2a2eedc9ca6e02e571595b90379d
4
+ data.tar.gz: 5512229010aa291eccd0f7aae359e7007b2eccfb
5
5
  SHA512:
6
- metadata.gz: 33d51b09b3101e09ceb24e72fdab255c32be4e7ee766610163bbaaac793b7ab5d64c12a27a693642238e290c233e673d34a34c60a83603d75ffbadd70035c589
7
- data.tar.gz: 0bb7e42f9e6bd99894952e29c5e5b1cffa388bb643cbe896b069097a36b74d3022bfe51855d372509b0ee32022da3851d7f71bf6f7e5eb3d0b852fcdd4d06ff0
6
+ metadata.gz: cfa3bf68fb302764c093774e54b72a4ad57ad4543b39a6e05a1cc706d4b8670559cdae735f9abded88926f38cfe0024efcded0f6210adfc790b9afa78a54121c
7
+ data.tar.gz: c1efda702378e821041575bcd9dd2f2b5867ef2b7fedffe54307b91e43b953708b21399deb381351b7b32a7efe12bbb39c3687617d7474549197b9d6c7b7c5bd
@@ -3,8 +3,8 @@ langauge: ruby
3
3
  env:
4
4
  - ACTIVE_MODEL_VERSION=3.2
5
5
  - ACTIVE_MODEL_VERSION=4.0
6
+ - ACTIVE_MODEL_VERSION=4.2
6
7
  rvm:
7
8
  - 1.9.3
8
- - 2.0.0
9
- - rbx
9
+ - 2.2.2
10
10
  - jruby-19mode
data/Readme.md CHANGED
@@ -51,6 +51,11 @@ If you want to make sure an attribute is before/after another attribute, use:
51
51
  validates :start_date, date: { before: :end_date }
52
52
  ```
53
53
 
54
+ If you want to allow an empty date, use:
55
+
56
+ ```ruby
57
+ validates :optional_date, date: { allow_blank: true }
58
+ ```
54
59
  ## Note on Patches/Pull Requests
55
60
 
56
61
  * Fork the project.
@@ -1,5 +1,6 @@
1
1
  require 'active_model/validations/date_validator'
2
2
  require 'active_support/i18n'
3
+ require 'date_validator/engine' if defined?(Rails)
3
4
 
4
5
  # A simple date validator for Rails 3.
5
6
  #
@@ -0,0 +1,5 @@
1
+ module DateValidator
2
+ class Engine < Rails::Engine
3
+ paths["config/locales"] = 'locales'
4
+ end
5
+ end
@@ -1,4 +1,4 @@
1
1
  module DateValidator
2
2
  # The version number.
3
- VERSION = "0.7.1"
3
+ VERSION = "0.8.0"
4
4
  end
@@ -0,0 +1,12 @@
1
+ # Sample localization file for Afrikaans. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale for starting points.
3
+ af:
4
+ errors:
5
+ messages:
6
+ not_a_date: "is nie 'n datum nie"
7
+ after: "moet na %{date} wees"
8
+ after_or_equal_to: "moet na of op %{date} wees"
9
+ before: "moet voor %{date} wees"
10
+ before_or_equal_to: "moet voor of op %{date} wees"
11
+ equal_to: "moet gelyk aan %{date} wees"
12
+ cannot_be_in_the_future: "kan nie in die toekoms wees nie"
@@ -1,11 +1,8 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
1
  ca:
5
2
  errors:
6
3
  messages:
7
- not_a_date: "is not a date"
8
- after: "must be after %{date}"
9
- after_or_equal_to: "must be after or equal to %{date}"
10
- before: "must be before %{date}"
11
- before_or_equal_to: "must be before or equal to %{date}"
4
+ not_a_date: "no és una data"
5
+ after: "ha de ser posterior a %{date}"
6
+ after_or_equal_to: "ha de ser posterior o igual a %{date}"
7
+ before: "ha de ser abans de %{date}"
8
+ before_or_equal_to: "ha de ser abans de o igual a %{date}"
@@ -6,3 +6,4 @@ it:
6
6
  after_or_equal_to: "deve essere successiva o uguale a %{date}"
7
7
  before: "deve essere antecedente a %{date}"
8
8
  before_or_equal_to: "deve essere antecedente o uguale a %{date}"
9
+ equal_to: "deve essere uguale a %{date}"
@@ -0,0 +1,9 @@
1
+ ja:
2
+ errors:
3
+ messages:
4
+ not_a_date: "は日付ではありません"
5
+ after: "は%{date}より前に設定してください"
6
+ after_or_equal_to: "は%{date}以前に設定してください"
7
+ before: "は%{date}より後に設定してください"
8
+ before_or_equal_to: "は%{date}以後に設定してください"
9
+ equal_to: "は%{date}にしてください"
@@ -113,7 +113,7 @@ module ActiveModel
113
113
  TestRecord.validates(:expiration_date, date: { after: Time.now.to_date }).must_be_kind_of Hash
114
114
  when :time_with_zone then
115
115
  Time.zone = "Hawaii"
116
- TestRecord.validates(:expiration_date, date: { before: Time.zone.parse((Time.now + 21000).to_s) }).must_be_kind_of Hash
116
+ TestRecord.validates(:expiration_date, date: { before: Time.zone.parse((Time.now + 21000).to_s, Time.now) }).must_be_kind_of Hash
117
117
  end
118
118
  end
119
119
  end
@@ -11,9 +11,7 @@ begin; require 'turn'; rescue LoadError; end
11
11
  gem 'minitest'
12
12
  require 'minitest/autorun'
13
13
 
14
- require 'active_support/core_ext'
15
- require 'active_support/time' # For testing Date and TimeWithZone objects
16
-
14
+ require 'active_support/all'
17
15
  require 'active_model'
18
16
  require 'date_validator'
19
17
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: date_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oriol Gual
@@ -10,76 +10,76 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-10-15 00:00:00.000000000 Z
13
+ date: 2015-05-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - '>='
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: minitest
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - '>='
33
+ - - ">="
34
34
  - !ruby/object:Gem::Version
35
35
  version: '0'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rake
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0'
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - '>='
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: activesupport
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - '>='
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: '0'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - '>='
68
+ - - ">="
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: tzinfo
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - '>='
75
+ - - ">="
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  description: A simple, ORM agnostic, Ruby 1.9 compatible date validator for Rails
@@ -91,12 +91,11 @@ executables: []
91
91
  extensions: []
92
92
  extra_rdoc_files: []
93
93
  files:
94
- - .document
95
- - .gemtest
96
- - .gitignore
97
- - .rspec
98
- - .rvmrc
99
- - .travis.yml
94
+ - ".document"
95
+ - ".gemtest"
96
+ - ".gitignore"
97
+ - ".rspec"
98
+ - ".travis.yml"
100
99
  - Gemfile
101
100
  - LICENSE
102
101
  - Rakefile
@@ -104,13 +103,16 @@ files:
104
103
  - date_validator.gemspec
105
104
  - lib/active_model/validations/date_validator.rb
106
105
  - lib/date_validator.rb
106
+ - lib/date_validator/engine.rb
107
107
  - lib/date_validator/version.rb
108
+ - locales/af.yml
108
109
  - locales/ca.yml
109
110
  - locales/de.yml
110
111
  - locales/en.yml
111
112
  - locales/es.yml
112
113
  - locales/fr.yml
113
114
  - locales/it.yml
115
+ - locales/ja.yml
114
116
  - locales/nl.yml
115
117
  - locales/pl.yml
116
118
  - locales/pt-BR.yml
@@ -126,17 +128,17 @@ require_paths:
126
128
  - lib
127
129
  required_ruby_version: !ruby/object:Gem::Requirement
128
130
  requirements:
129
- - - '>='
131
+ - - ">="
130
132
  - !ruby/object:Gem::Version
131
133
  version: '0'
132
134
  required_rubygems_version: !ruby/object:Gem::Requirement
133
135
  requirements:
134
- - - '>='
136
+ - - ">="
135
137
  - !ruby/object:Gem::Version
136
138
  version: '0'
137
139
  requirements: []
138
140
  rubyforge_project: date_validator
139
- rubygems_version: 2.0.14
141
+ rubygems_version: 2.4.5
140
142
  signing_key:
141
143
  specification_version: 4
142
144
  summary: A simple, ORM agnostic, Ruby 1.9 compatible date validator for Rails 3, based
@@ -144,4 +146,3 @@ summary: A simple, ORM agnostic, Ruby 1.9 compatible date validator for Rails 3,
144
146
  test_files:
145
147
  - test/date_validator_test.rb
146
148
  - test/test_helper.rb
147
- has_rdoc:
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use ruby-2.0.0@date_validator --create