IBAN 0.2.0 → 0.2.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: 454a12c86cb6702c7d05c757e48d93f90d15a1a4
4
- data.tar.gz: e10448ec9189e384306e427e04b9c89d95ffb203
3
+ metadata.gz: 29111a6d6e2f2e69b331bf73891074a3ee020687
4
+ data.tar.gz: 006dd584ec8d64200dc76badea64e0035873e779
5
5
  SHA512:
6
- metadata.gz: 074f4b0a9540ed5ba0a6d3ed57feb878c2a6deab08f0ce0604353171cb391db5bd6133b0e2e133ca16cb04c85c6d90ab3b931672cd09175cf4d322618e298e91
7
- data.tar.gz: f97cc073c5d44aac9167a74505ca1bec0857897b2cf264116ab1951deb11949699421065228d276aa83f9b5bb2a3d255a2c811cf3de0b3332c95b92ce1f14c0e
6
+ metadata.gz: 0db3859b6d829864f89a4c2971ac37d4309174854aad249eea9814b4f01c85981aeb588e60a5f920d096c03bf66e3599ee2bdf077916ae3e6cfb5e7e0d6ed2e5
7
+ data.tar.gz: 45b77d0f92b2c49c85b1807ac907de678b401cc56f4a95e6cefb55df58e8443f5ae27314985362915ac6b8bfd316b603d6e44928165d2ed8739ddce8af98a938
@@ -12,7 +12,7 @@ class IBAN
12
12
  end
13
13
 
14
14
  def initialize(code)
15
- @code = code.strip.gsub(/\s+/, '').upcase
15
+ @code = code.to_s.strip.gsub(/\s+/, '').upcase
16
16
  end
17
17
 
18
18
  def country_code
@@ -1,3 +1,3 @@
1
1
  class IBAN
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -11,6 +11,18 @@ class Company
11
11
  end
12
12
  end
13
13
 
14
+ class Person
15
+ include ActiveModel::Model
16
+
17
+ attr_accessor :iban, :name
18
+ validates :iban, iban: true, allow_nil: true
19
+
20
+ def persisted?
21
+ false
22
+ end
23
+ end
24
+
25
+
14
26
  describe IbanValidator do
15
27
  before {
16
28
  @model = Company.new
@@ -26,4 +38,15 @@ describe IbanValidator do
26
38
  @model.valid?.must_equal false
27
39
  @model.errors[:iban].must_include "is invalid"
28
40
  end
41
+
42
+ it "should not validate with nil value" do
43
+ @model.iban.must_equal nil
44
+ @model.valid?.must_equal false
45
+ end
46
+
47
+ it "should not use the validator with option allow_nil: true" do
48
+ @person = Person.new
49
+ @person.iban.must_equal nil
50
+ @person.valid?.must_equal true
51
+ end
29
52
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: IBAN
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '4.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '4.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: activemodel
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: 'IBAN: International Bank Account Number'
@@ -73,8 +73,8 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
78
  - Gemfile
79
79
  - LICENSE.txt
80
80
  - README.md
@@ -97,17 +97,17 @@ require_paths:
97
97
  - lib
98
98
  required_ruby_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - '>='
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
- - - '>='
105
+ - - ">="
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.0.3
110
+ rubygems_version: 2.2.0
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: IBAN information, validation and formatting.
@@ -115,4 +115,3 @@ test_files:
115
115
  - spec/activemodel_spec.rb
116
116
  - spec/iban_spec.rb
117
117
  - spec/spec_helper.rb
118
- has_rdoc: