bic_validation 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/bic_validation/bic.rb +5 -1
- data/lib/bic_validation/version.rb +1 -1
- data/spec/bic_validation/bic_spec.rb +16 -0
- metadata +2 -2
data/lib/bic_validation/bic.rb
CHANGED
|
@@ -4,7 +4,7 @@ module BicValidation
|
|
|
4
4
|
class Bic
|
|
5
5
|
|
|
6
6
|
def initialize(code)
|
|
7
|
-
@code = code.strip.upcase
|
|
7
|
+
@code = code.to_s.strip.upcase
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def of_valid_length?
|
|
@@ -36,6 +36,10 @@ module BicValidation
|
|
|
36
36
|
has_valid_branch_code?
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
def invalid?
|
|
40
|
+
!valid?
|
|
41
|
+
end
|
|
42
|
+
|
|
39
43
|
def bank
|
|
40
44
|
match[1]
|
|
41
45
|
end
|
|
@@ -2,6 +2,22 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
module BicValidation
|
|
4
4
|
describe Bic do
|
|
5
|
+
context 'with bogus data' do
|
|
6
|
+
it 'survives nil data' do
|
|
7
|
+
bic = Bic.new(nil)
|
|
8
|
+
expect(bic).to be_invalid
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'survives integer data' do
|
|
12
|
+
bic = Bic.new(123)
|
|
13
|
+
expect(bic).to be_invalid
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'survives float data' do
|
|
17
|
+
bic = Bic.new(1.23)
|
|
18
|
+
expect(bic).to be_invalid
|
|
19
|
+
end
|
|
20
|
+
end
|
|
5
21
|
|
|
6
22
|
context 'basic methods 11 digit' do
|
|
7
23
|
before { @bic = Bic.new 'MARKDEF1850' }
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bic_validation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-10-
|
|
12
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activemodel
|