yukonisuru 0.0.1 → 1.0.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: 3c3f2c762bbaa9cabb75c03afe24d51b419a75ab
4
- data.tar.gz: bde30ebfcc52b09306dcd6d445e0ebb1364a2116
3
+ metadata.gz: 1bfbad2a08704948f049f06b6e2975be3a4e3dbb
4
+ data.tar.gz: e9aded8aa980d3421cc752e13b3f2249b5f900b4
5
5
  SHA512:
6
- metadata.gz: 1d93a981e44cae5dd6077f49d22f7ef1dd24cfb32a8056966f7e3430a14442cf3ab5989edca74ee06faa416adb01eabe8a68845c91d9e18723375099c42baaa2
7
- data.tar.gz: 8f84d81a471db4ae0c2804280f6ae885c9b95c10cc241a5f9566da0bee74090e85dd61884b5dca70a5e988b1b713cb2111d498d9e4326a607c99503141e8575f
6
+ metadata.gz: 2bf94fa310201e2a03974fb16839bad0cc995c25d317f9183e0d8446bbd7bfe59322c191b372fca4768ff424fea3f141554568edabcbf9da6a28c878a14b2592
7
+ data.tar.gz: 3522dd6f6d32d569c9c39bcbcaa0482c5b071bb7ddf5c8492ae62afeff2c7d8a42fd020631f1fe500d97b35b4cbdaaa0b9f8dce72c7fed6716223f4cb6d04b32
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  [![Gem Version](https://badge.fury.io/rb/yukonisuru.svg)](http://badge.fury.io/rb/yukonisuru)
4
4
  [![Build Status](https://travis-ci.org/drexed/yukonisuru.svg?branch=master)](https://travis-ci.org/drexed/yukonisuru)
5
5
  [![Coverage Status](https://coveralls.io/repos/drexed/yukonisuru/badge.png)](https://coveralls.io/r/drexed/yukonisuru)
6
- [![Code Climate](https://codeclimate.com/github/drexed/yukonisuru.png)](https://codeclimate.com/github/drexed/yukonisuru)
7
6
 
8
7
  Yukonisuru (japanese: validate) is a collection of custom validators that are often required in Rails applications plus shoulda-style RSpec matchers to test the validation rules.
9
8
 
@@ -24,8 +24,7 @@ class AlphaNumericValidator < ActiveModel::EachValidator
24
24
  end
25
25
 
26
26
  def valid?(value, options)
27
- valid_format?(value, options) &&
28
- valid_length?(value)
27
+ valid_format?(value, options) && valid_length?(value)
29
28
  end
30
29
 
31
30
  end
@@ -8,10 +8,6 @@ class GtinValidator < ActiveModel::EachValidator
8
8
 
9
9
  private
10
10
 
11
- def includes_key?(value, options)
12
- value.any? { |key| options.keys.include?(key) }
13
- end
14
-
15
11
  def valid_format?(value, options)
16
12
  if options[:strict]
17
13
  value =~ /^[0-9]+$/
@@ -39,7 +35,7 @@ class GtinValidator < ActiveModel::EachValidator
39
35
 
40
36
  def valid_checksum?(value)
41
37
  reversed_values = value.reverse
42
- odd = even = 0
38
+ odd, even = 0, 0
43
39
 
44
40
  (1..(reversed_values.length - 1)).each do |i|
45
41
  i.even? ? (even += reversed_values[i].chr.to_i) : (odd += reversed_values[i].chr.to_i)
@@ -1,3 +1,3 @@
1
1
  module Yukonisuru
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -29,12 +29,10 @@ describe PasswordValidator do
29
29
  it { should_not allow_value('').for(:password) }
30
30
  it { should_not allow_value(' ').for(:password) }
31
31
  it { should_not allow_value(nil).for(:password) }
32
- it { should_not allow_value("pass").for(:password) }
33
32
  it { should_not allow_value(" password").for(:password) }
34
33
  it { should_not allow_value(" password ").for(:password) }
35
34
  it { should_not allow_value("password ").for(:password) }
36
35
  it { should_not allow_value("pass word").for(:password) }
37
- it { should_not allow_value("password-12345678910").for(:password) }
38
36
  it { should_not allow_value("! \#$%\`|").for(:password) }
39
37
  it { should_not allow_value("<>@[]\`|").for(:password) }
40
38
 
@@ -34,9 +34,6 @@ describe UrlValidator do
34
34
  it { should_not allow_value(' ').for(:url) }
35
35
  it { should_not allow_value(nil).for(:url) }
36
36
  it { should_not allow_value("example").for(:url) }
37
- it { should_not allow_value("http://user_examplecom").for(:url) }
38
- it { should_not allow_value("http://user_example.com").for(:url) }
39
- it { should_not allow_value("http://user_example.a").for(:url) }
40
37
  it { should_not allow_value("ftp://foo.bar.baz.com").for(:url) }
41
38
  end
42
39
 
@@ -1,11 +1,11 @@
1
1
  require 'coveralls'
2
2
  require 'active_model'
3
3
  require 'active_support'
4
- require 'yukonisuru'
5
-
6
4
  require 'shoulda/matchers'
7
5
  require 'shoulda-matchers'
8
6
 
7
+ require 'yukonisuru'
8
+
9
9
  I18n.load_path << File.expand_path("../../config/locales/en.yml", __FILE__)
10
10
  I18n.enforce_available_locales = false
11
11
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yukonisuru
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  version: '0'
230
230
  requirements: []
231
231
  rubyforge_project:
232
- rubygems_version: 2.4.5
232
+ rubygems_version: 2.4.6
233
233
  signing_key:
234
234
  specification_version: 4
235
235
  summary: Gem for commonly used validators.