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 +4 -4
- data/README.md +0 -1
- data/lib/yukonisuru/validators/alpha_numeric_validator.rb +1 -2
- data/lib/yukonisuru/validators/gtin_validator.rb +1 -5
- data/lib/yukonisuru/version.rb +1 -1
- data/spec/lib/password_validator_spec.rb +0 -2
- data/spec/lib/url_validator_spec.rb +0 -3
- data/spec/spec_helper.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bfbad2a08704948f049f06b6e2975be3a4e3dbb
|
4
|
+
data.tar.gz: e9aded8aa980d3421cc752e13b3f2249b5f900b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
@@ -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
|
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)
|
data/lib/yukonisuru/version.rb
CHANGED
@@ -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
|
|
data/spec/spec_helper.rb
CHANGED
@@ -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
|
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-
|
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.
|
232
|
+
rubygems_version: 2.4.6
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: Gem for commonly used validators.
|