birth_date_validator 0.1 → 0.1.1

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: 4b5a31fcb07e05495ee29fe4ef37595b5d0edb6d
4
- data.tar.gz: a8236b243349fa2d66ea3403a892ed388b89bb6b
3
+ metadata.gz: 637fbf5ffb1b89666920f75b64b28235675e6e05
4
+ data.tar.gz: ea0ae65a07369d83b7afb1a98a7bf2cd756f8f3b
5
5
  SHA512:
6
- metadata.gz: 27c7d82bd110439e65e370ce5678703d5353878538b3448af7d1b7d346c6bdaf034ce2082582a6eb92b6b1d26cb56a4933ed527810fa614917b4e463d5b3d351
7
- data.tar.gz: 174951b37ecd6863530592bfd546df0dfae4bf32e67a06ab82724db469a871143bcb3114584b764b4d63d3241c7719f74f7ac3f93bba5eb6e1a75ab041413e87
6
+ metadata.gz: 6abb63db105fd429c30576ffee9576715f8c62305b67b8711cc33a90403239221a546704e510cd9c7316461089d861d7fa739e78780407f322e75c0c81b3db79
7
+ data.tar.gz: 8239879492d557669c5186c78a7776d6384b1de59017019209b69e6b7a964f50a75fb413ba5748c58c2f5397955e991d4f5c05fefed70f882bc5a8a6f842e2b3
@@ -10,8 +10,8 @@
10
10
 
11
11
  class BirthDateValidator < ActiveModel::EachValidator
12
12
  def validate_each(record, attribute, value)
13
- invalid = if options[:almost].present?
14
- value.year > options[:almost].year
13
+ invalid = if options[:at_least].present?
14
+ value.year > options[:at_least].year
15
15
  elsif options[:less_then].present?
16
16
  value.year <= options[:less_then].year
17
17
  elsif options[:range].present?
@@ -9,5 +9,5 @@
9
9
  #++
10
10
 
11
11
  class BirthDateValidator
12
- VERSION = '0.1'
13
- end
12
+ VERSION = '0.1.1'
13
+ end
@@ -1,7 +1,7 @@
1
1
  require './spec_helper'
2
2
 
3
3
  describe BirthDateValidator do
4
- describe 'user has to have almost 18 years' do
4
+ describe 'user has to have at least 18 years' do
5
5
  context '19 years old' do
6
6
  it 'is valid' do
7
7
  expect(TestUserOverAge.new(birth_date: 19.years.ago)).to be_valid
data/spec/spec_helper.rb CHANGED
@@ -16,7 +16,7 @@ class TestModel
16
16
  end
17
17
 
18
18
  class TestUserOverAge < TestModel
19
- validates :birth_date, birth_date: { almost: 18.years.ago, message: 'come back when you will be older' }
19
+ validates :birth_date, birth_date: { at_least: 18.years.ago, message: 'come back when you will be older' }
20
20
  end
21
21
 
22
22
  class TestUserUnderAge < TestModel
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: birth_date_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Capuano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-15 00:00:00.000000000 Z
11
+ date: 2014-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel