validates_iban_format_of 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/README.md +90 -0
- data/Rakefile +6 -0
- data/config/locales/en.yml +8 -0
- data/lib/validates_iban_format_of.rb +54 -0
- data/lib/validates_iban_format_of/active_model.rb +20 -0
- data/lib/validates_iban_format_of/railtie.rb +7 -0
- data/lib/validates_iban_format_of/rspec_matcher.rb +15 -0
- data/lib/validates_iban_format_of/version.rb +3 -0
- data/spec/rspec_matcher_spec.rb +14 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/validates_iban_format_of_spec.rb +189 -0
- data/validates_iban_format_of.gemspec +22 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a7857aa63e60413b700f7e592b78e93cbfdc0830
|
4
|
+
data.tar.gz: 3e20eab0f8a9e4db63e766368c842ee121ebbcbc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fc4aa352f55c15a156beaf6e1221d25d710104de24b7b1fd95a4bc88757020d41e2af697899764656b594c82662725755e3a4afb60b082c9b2ac3cdfda598100
|
7
|
+
data.tar.gz: 7c6fddd7ecdd3284dabddeff48da12fca3fece2b2fc6f80b3a0adcad55aedd088c7ec0a5a58f205a0bb19092218c08d3475265cfe9ab62c5f1241a21c96e05b9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2017 Dimitar Kostov
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# validates_iban_format_of
|
2
|
+
|
3
|
+
Rails IBAN validator based on [iban-tools gem](https://github.com/alphasights/iban-tools)
|
4
|
+
|
5
|
+
# Installation
|
6
|
+
|
7
|
+
Add it to your Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'validates_iban_format_of'
|
11
|
+
```
|
12
|
+
|
13
|
+
# Usage
|
14
|
+
|
15
|
+
## In ActiveRecord model
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
# I18n locales are loaded automatically.
|
19
|
+
|
20
|
+
class BankAccount < ActiveRecord::Base
|
21
|
+
validates_iban_format_of :iban, message_for_invalid: 'is not incorrect', message_for_missing: 'is blank'
|
22
|
+
|
23
|
+
# OR
|
24
|
+
# validates :iban, iban_format: { message_for_invalid: 'is not incorrect', message_for_missing: 'is blank' }
|
25
|
+
end
|
26
|
+
```
|
27
|
+
|
28
|
+
### In your model spec using RSpec:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
require "validates_iban_format_of/rspec_matcher"
|
32
|
+
|
33
|
+
describe Person do
|
34
|
+
it { should validate_iban_format_of(:iban).with_message('is not looking good') }
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
38
|
+
### Options
|
39
|
+
|
40
|
+
```rdoc
|
41
|
+
:message_for_invalid
|
42
|
+
String. A custom error message when the iban is invalid (default is: "is invalid")
|
43
|
+
|
44
|
+
:message_for_missing
|
45
|
+
String. A custom error message when the iban is missing (default is: "is missing")
|
46
|
+
|
47
|
+
:optional
|
48
|
+
Boolean. Flag to turn off valdiation for blank/nil case
|
49
|
+
|
50
|
+
:generate_message
|
51
|
+
Boolean. Return the I18n key of the error message instead of the error message itself (default is false)
|
52
|
+
|
53
|
+
:on, :if, :unless, :allow_nil, :allow_blank, :strict
|
54
|
+
Standard ActiveModel validation options. These work in the ActiveModel/ActiveRecord/Rails syntax only.
|
55
|
+
See http://api.rubyonrails.org/classes/ActiveModel/Validations/ClassMethods.html#method-i-validates for details.
|
56
|
+
```
|
57
|
+
|
58
|
+
# Testing
|
59
|
+
|
60
|
+
To execute the unit tests run <tt>rspec</tt>.
|
61
|
+
|
62
|
+
# Credits
|
63
|
+
|
64
|
+
Written by [Dimitar Kostov](https://github.com/mytrile) [mitko.kostov@gmail.com](mailto:mitko.kostov@gmail.com)
|
65
|
+
|
66
|
+
Many thanks to the [iban-tools gem](https://github.com/alphasights/iban-tools) for the real validation
|
67
|
+
|
68
|
+
|
69
|
+
# LICENSE
|
70
|
+
|
71
|
+
Copyright (c) 2017 Dimitar Kostov
|
72
|
+
|
73
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
74
|
+
a copy of this software and associated documentation files (the
|
75
|
+
"Software"), to deal in the Software without restriction, including
|
76
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
77
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
78
|
+
permit persons to whom the Software is furnished to do so, subject to
|
79
|
+
the following conditions:
|
80
|
+
|
81
|
+
The above copyright notice and this permission notice shall be
|
82
|
+
included in all copies or substantial portions of the Software.
|
83
|
+
|
84
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
87
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
88
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
89
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
90
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'validates_iban_format_of/version'
|
2
|
+
require 'iban-tools'
|
3
|
+
|
4
|
+
module ValidatesIbanFormatOf
|
5
|
+
def self.load_i18n_locales
|
6
|
+
require 'i18n'
|
7
|
+
I18n.load_path += Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'locales', '*.yml')))
|
8
|
+
end
|
9
|
+
|
10
|
+
DEFAULT_MESSAGE_FOR_INVALID = 'is invalid'
|
11
|
+
DEFAULT_MESSAGE_FOR_MISSING = 'is missing'
|
12
|
+
ERROR_MESSAGE_INVALID_I18N_KEY = :invalid_iban
|
13
|
+
ERROR_MESSAGE_MISSING_I18N_KEY = :missing_iban
|
14
|
+
|
15
|
+
def self.default_message_for_invalid
|
16
|
+
defined?(I18n) ? I18n.t(ERROR_MESSAGE_INVALID_I18N_KEY, scope: %i(activemodel errors messages), default: DEFAULT_MESSAGE_FOR_INVALID) : DEFAULT_MESSAGE_FOR_INVALID
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.default_message_for_missing
|
20
|
+
defined?(I18n) ? I18n.t(ERROR_MESSAGE_MISSING_I18N_KEY, scope: %i(activemodel errors messages), default: DEFAULT_MESSAGE_FOR_MISSING) : DEFAULT_MESSAGE_FOR_MISSING
|
21
|
+
end
|
22
|
+
|
23
|
+
# Validates whether the specified value is a valid IBAN. Returns nil if the value is valid, otherwise returns an array
|
24
|
+
# containing one or more validation error messages.
|
25
|
+
#
|
26
|
+
# Configuration options:
|
27
|
+
# * <tt>message_for_invalid</tt> - A custom error message for invalid (default is: 'is invalid')
|
28
|
+
# * <tt>message_for_missing</tt> - A custom error message for missing (default is: 'is missing')
|
29
|
+
# * <tt>optional</tt> - Flag to run valdiation ignoring blank/nil case
|
30
|
+
# * <tt>generate_message</tt> Return the I18n key of the error message instead of the error message itself (default is false)
|
31
|
+
def self.validate_iban_format(iban, options={})
|
32
|
+
default_options = {
|
33
|
+
message_for_invalid: options[:generate_message] ? ERROR_MESSAGE_INVALID_I18N_KEY : default_message_for_invalid,
|
34
|
+
message_for_missing: options[:generate_message] ? ERROR_MESSAGE_MISSING_I18N_KEY : default_message_for_missing,
|
35
|
+
generate_message: false,
|
36
|
+
optional: false
|
37
|
+
}
|
38
|
+
|
39
|
+
opts = options.merge(default_options) {|key, old, new| old} # merge the default options into the specified options, retaining all specified options
|
40
|
+
|
41
|
+
if opts[:optional]
|
42
|
+
return nil if iban.nil? || iban.empty?
|
43
|
+
end
|
44
|
+
|
45
|
+
return [ opts[:message_for_missing] ] if iban.nil? || iban.empty?
|
46
|
+
|
47
|
+
return [ opts[:message_for_invalid] ] unless IBANTools::IBAN.valid?(iban)
|
48
|
+
|
49
|
+
return nil
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
require 'validates_iban_format_of/active_model' if defined?(::ActiveModel) && !(ActiveModel::VERSION::MAJOR < 2 || (2 == ActiveModel::VERSION::MAJOR && ActiveModel::VERSION::MINOR < 1))
|
54
|
+
require 'validates_iban_format_of/railtie' if defined?(::Rails)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'validates_iban_format_of'
|
2
|
+
require 'active_model'
|
3
|
+
|
4
|
+
module ActiveModel
|
5
|
+
module Validations
|
6
|
+
class IbanFormatValidator < EachValidator
|
7
|
+
def validate_each(record, attribute, value)
|
8
|
+
(ValidatesIbanFormatOf::validate_iban_format(value, options.merge(generate_message: true)) || []).each do |error|
|
9
|
+
record.errors.add(attribute, error)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
module HelperMethods
|
15
|
+
def validates_iban_format_of(*attr_names)
|
16
|
+
validates_with IbanFormatValidator, _merge_attributes(attr_names)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'validates_iban_format_of'
|
2
|
+
|
3
|
+
RSpec::Matchers.define :validate_iban_format_of do |attribute|
|
4
|
+
match do
|
5
|
+
actual_class_name = subject.is_a?(Class) ? subject : subject.class
|
6
|
+
actual = actual_class_name.new
|
7
|
+
actual.send(:"#{attribute}=", 'GB82 WEST 1234')
|
8
|
+
expect(actual).to be_invalid
|
9
|
+
@expected_message ||= ValidatesIbanFormatOf.default_message_for_invalid
|
10
|
+
actual.errors[attribute.to_sym].include?(@expected_message)
|
11
|
+
end
|
12
|
+
chain :with_message do |message|
|
13
|
+
@expected_message = message
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "#{File.expand_path(File.dirname(__FILE__))}/spec_helper"
|
2
|
+
if defined?(ActiveModel)
|
3
|
+
require "validates_iban_format_of/rspec_matcher"
|
4
|
+
|
5
|
+
class Person
|
6
|
+
attr_accessor :iban
|
7
|
+
include ::ActiveModel::Validations
|
8
|
+
validates_iban_format_of :iban
|
9
|
+
end
|
10
|
+
|
11
|
+
describe Person do
|
12
|
+
it { should validate_iban_format_of(:iban) }
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "active_model" if Gem.loaded_specs.keys.include?("activemodel")
|
2
|
+
|
3
|
+
RSpec::Matchers.define :have_errors_on_iban do
|
4
|
+
match do |actual|
|
5
|
+
expect(actual).not_to be_nil, "#{actual} should not be nil"
|
6
|
+
expect(actual).not_to be_empty, "#{actual} should not be empty"
|
7
|
+
expect(actual.size).to eq(@reasons.size), "#{actual} should have #{@reasons.size} elements"
|
8
|
+
@reasons.each do |reason|
|
9
|
+
reason = "#{"IBAN " if defined?(ActiveModel)}#{reason}"
|
10
|
+
expect(actual).to include(reason), "#{actual} should contain #{reason}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
chain :because do |reason|
|
14
|
+
(@reasons ||= []) << reason
|
15
|
+
end
|
16
|
+
chain :and_because do |reason|
|
17
|
+
(@reasons ||= []) << reason
|
18
|
+
end
|
19
|
+
match_when_negated do |actual|
|
20
|
+
expect(actual).to (defined?(ActiveModel) ? be_empty : be_nil)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
RSpec.configure do |config|
|
25
|
+
config.before(:suite) do
|
26
|
+
ValidatesIbanFormatOf.load_i18n_locales
|
27
|
+
I18n.enforce_available_locales = false
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,189 @@
|
|
1
|
+
require "#{File.expand_path(File.dirname(__FILE__))}/spec_helper"
|
2
|
+
require "validates_iban_format_of"
|
3
|
+
|
4
|
+
describe ValidatesIbanFormatOf do
|
5
|
+
subject do |example|
|
6
|
+
if defined?(ActiveModel)
|
7
|
+
user = Class.new do
|
8
|
+
def initialize(iban)
|
9
|
+
@iban = iban.freeze
|
10
|
+
end
|
11
|
+
attr_reader :iban
|
12
|
+
include ActiveModel::Validations
|
13
|
+
validates_iban_format_of :iban, example.example_group_instance.options
|
14
|
+
end
|
15
|
+
example.example_group_instance.class::User = user
|
16
|
+
user.new(example.example_group_instance.iban).tap(&:valid?).errors.full_messages
|
17
|
+
else
|
18
|
+
ValidatesIbanFormatOf::validate_iban_format(iban.freeze, options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
let(:options) { {} }
|
22
|
+
let(:iban) { |example| example.example_group.description }
|
23
|
+
|
24
|
+
shared_examples_for :all_specs do
|
25
|
+
# Taken directly from iban-tools gem
|
26
|
+
# Samples from http://www.tbg5-finance.org/?ibandocs.shtml/
|
27
|
+
[
|
28
|
+
"AD1200012030200359100100",
|
29
|
+
"AE070331234567890123456",
|
30
|
+
"AL47212110090000000235698741",
|
31
|
+
"AT611904300234573201",
|
32
|
+
"AZ21NABZ00000000137010001944",
|
33
|
+
"BA391290079401028494",
|
34
|
+
"BE68539007547034",
|
35
|
+
"BG80BNBG96611020345678",
|
36
|
+
"BH67BMAG00001299123456",
|
37
|
+
"BR9700360305000010009795493P1",
|
38
|
+
"CH9300762011623852957",
|
39
|
+
"CY17002001280000001200527600",
|
40
|
+
"CZ6508000000192000145399",
|
41
|
+
"DE89370400440532013000",
|
42
|
+
"DK5000400440116243",
|
43
|
+
"DO28BAGR00000001212453611324",
|
44
|
+
"EE382200221020145685",
|
45
|
+
"ES9121000418450200051332",
|
46
|
+
"FI2112345600000785",
|
47
|
+
"FO7630004440960235",
|
48
|
+
"FR1420041010050500013M02606",
|
49
|
+
"GB29NWBK60161331926819",
|
50
|
+
"GE29NB0000000101904917",
|
51
|
+
"GI75NWBK000000007099453",
|
52
|
+
"GL4330003330229543",
|
53
|
+
"GR1601101250000000012300695",
|
54
|
+
"HR1210010051863000160",
|
55
|
+
"HU42117730161111101800000000",
|
56
|
+
"IE29AIBK93115212345678",
|
57
|
+
"IL620108000000099999999",
|
58
|
+
"IS140159260076545510730339",
|
59
|
+
"IT60X0542811101000000123456",
|
60
|
+
"JO94CBJO0010000000000131000302",
|
61
|
+
"KW81CBKU0000000000001234560101",
|
62
|
+
"KZ86125KZT5004100100",
|
63
|
+
"LB62099900000001001901229114",
|
64
|
+
"LI21088100002324013AA",
|
65
|
+
"LT121000011101001000",
|
66
|
+
"LU280019400644750000",
|
67
|
+
"LV80BANK0000435195001",
|
68
|
+
"MC1112739000700011111000h79",
|
69
|
+
"MD24AG000225100013104168",
|
70
|
+
"ME25505000012345678951",
|
71
|
+
"MK07300000000042425",
|
72
|
+
"MR1300020001010000123456753",
|
73
|
+
"MT84MALT011000012345MTLCAST001S",
|
74
|
+
"MU17BOMM0101101030300200000MUR",
|
75
|
+
"NL91ABNA0417164300",
|
76
|
+
"NO9386011117947",
|
77
|
+
"PL27114020040000300201355387",
|
78
|
+
"PK36SCBL0000001123456702",
|
79
|
+
"PT50000201231234567890154",
|
80
|
+
"QA58DOHB00001234567890ABCDEFG",
|
81
|
+
"RO49AAAA1B31007593840000",
|
82
|
+
"RS35260005601001611379",
|
83
|
+
"SA0380000000608010167519",
|
84
|
+
"SE3550000000054910000003",
|
85
|
+
"SI56191000000123438",
|
86
|
+
"SK3112000000198742637541",
|
87
|
+
"SM86U0322509800000000270100",
|
88
|
+
"TN5914207207100707129648",
|
89
|
+
"TR330006100519786457841326",
|
90
|
+
"UA173052990006762462622943782"
|
91
|
+
].each do |address|
|
92
|
+
describe address do
|
93
|
+
it { should_not have_errors_on_iban }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
[
|
98
|
+
"random string",
|
99
|
+
12345698765432,
|
100
|
+
"gb99 %BC",
|
101
|
+
"NOW9386011117947",
|
102
|
+
"GB69 7654 1234 5698 7654 32",
|
103
|
+
"GB99 WEST 1234 5698 7654 32",
|
104
|
+
"RO7999991B31007593840000"
|
105
|
+
].each do |address|
|
106
|
+
describe address do
|
107
|
+
it { should have_errors_on_iban.because("is invalid") }
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe "" do
|
112
|
+
it { should have_errors_on_iban.because("is missing") }
|
113
|
+
end
|
114
|
+
|
115
|
+
describe nil do
|
116
|
+
it { should have_errors_on_iban.because("is missing") }
|
117
|
+
end
|
118
|
+
|
119
|
+
describe "with optional config" do
|
120
|
+
let(:options) { { optional: true } }
|
121
|
+
describe "" do
|
122
|
+
it { should_not have_errors_on_iban }
|
123
|
+
end
|
124
|
+
|
125
|
+
describe nil do
|
126
|
+
it { should_not have_errors_on_iban }
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "custom error messages" do
|
131
|
+
describe "invalid example" do
|
132
|
+
let(:options) { { message_for_invalid: "just because it's invalid" } }
|
133
|
+
it { should have_errors_on_iban.because("just because it's invalid") }
|
134
|
+
end
|
135
|
+
describe "" do
|
136
|
+
let(:options) { { message_for_missing: "is blank" } }
|
137
|
+
it { should have_errors_on_iban.because("is blank") }
|
138
|
+
end
|
139
|
+
describe nil do
|
140
|
+
let(:options) { { message_for_missing: "is blank" } }
|
141
|
+
it { should have_errors_on_iban.because("is blank") }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe "i18n" do
|
146
|
+
before(:each) do
|
147
|
+
allow(I18n.config).to receive(:locale).and_return(locale)
|
148
|
+
end
|
149
|
+
|
150
|
+
unless defined?(ActiveModel)
|
151
|
+
describe "missing locale" do
|
152
|
+
let(:locale) { :ir }
|
153
|
+
describe "invalid exmaple" do
|
154
|
+
it { should have_errors_on_iban.because("is invalid") }
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
unless defined?(ActiveModel)
|
160
|
+
describe "without i18n" do
|
161
|
+
before(:each) { hide_const("I18n") }
|
162
|
+
describe "invalid@exmaple." do
|
163
|
+
it { should have_errors_on_iban.because("is invalid") }
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
it_should_behave_like :all_specs
|
170
|
+
|
171
|
+
if defined?(ActiveModel)
|
172
|
+
describe "shorthand ActiveModel validation" do
|
173
|
+
subject do |example|
|
174
|
+
user = Class.new do
|
175
|
+
def initialize(iban)
|
176
|
+
@iban = iban.freeze
|
177
|
+
end
|
178
|
+
attr_reader :iban
|
179
|
+
include ActiveModel::Validations
|
180
|
+
validates :iban, iban_format: example.example_group_instance.options
|
181
|
+
end
|
182
|
+
example.example_group_instance.class::User = user
|
183
|
+
user.new(example.example_group_instance.iban).tap(&:valid?).errors.full_messages
|
184
|
+
end
|
185
|
+
|
186
|
+
it_should_behave_like :all_specs
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
require 'validates_iban_format_of/version'
|
3
|
+
|
4
|
+
spec = Gem::Specification.new do |s|
|
5
|
+
s.name = 'validates_iban_format_of'
|
6
|
+
s.version = ValidatesIbanFormatOf::VERSION
|
7
|
+
s.summary = 'Validate iban'
|
8
|
+
s.description = s.summary
|
9
|
+
s.authors = ['Dimitar Kostov']
|
10
|
+
s.email = ['mitko.kostov@gmail.com']
|
11
|
+
s.homepage = 'https://github.com/mytrile/validates_iban_format_of'
|
12
|
+
s.license = 'MIT'
|
13
|
+
s.test_files = s.files.grep(%r{^spec/})
|
14
|
+
s.files = `git ls-files`.split($/)
|
15
|
+
s.require_paths = ['lib']
|
16
|
+
|
17
|
+
s.add_dependency 'i18n', '~> 0.7'
|
18
|
+
s.add_dependency 'activesupport', '~> 4.2'
|
19
|
+
s.add_dependency 'iban-tools', '~> 1.1'
|
20
|
+
s.add_development_dependency 'bundler', '~> 1.13'
|
21
|
+
s.add_development_dependency 'rspec', '~> 3.6'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: validates_iban_format_of
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dimitar Kostov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: i18n
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: iban-tools
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.13'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.13'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.6'
|
83
|
+
description: Validate iban
|
84
|
+
email:
|
85
|
+
- mitko.kostov@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- config/locales/en.yml
|
97
|
+
- lib/validates_iban_format_of.rb
|
98
|
+
- lib/validates_iban_format_of/active_model.rb
|
99
|
+
- lib/validates_iban_format_of/railtie.rb
|
100
|
+
- lib/validates_iban_format_of/rspec_matcher.rb
|
101
|
+
- lib/validates_iban_format_of/version.rb
|
102
|
+
- spec/rspec_matcher_spec.rb
|
103
|
+
- spec/spec_helper.rb
|
104
|
+
- spec/validates_iban_format_of_spec.rb
|
105
|
+
- validates_iban_format_of.gemspec
|
106
|
+
homepage: https://github.com/mytrile/validates_iban_format_of
|
107
|
+
licenses:
|
108
|
+
- MIT
|
109
|
+
metadata: {}
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options: []
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 2.6.8
|
127
|
+
signing_key:
|
128
|
+
specification_version: 4
|
129
|
+
summary: Validate iban
|
130
|
+
test_files: []
|