bank-validator 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/bank-validator.gemspec +2 -2
- data/lib/active_model/iban_validator.rb +1 -1
- data/test/test_bank-validator.rb +16 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a46fbc13a9cac58d289a439168a4ecdab0e9fa8
|
4
|
+
data.tar.gz: 15b35484a766720f8fd2a3651014bddb0793714b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d100a081f72f95deb1e07fc40bd4f822089489563973110bd1937153266ca387b47d6af93340c1b90cef36b465eb62bcbbdd5cdb4e912ed8bf1945ee2f1dee5d
|
7
|
+
data.tar.gz: 5c73fe4cdcc43fc4d91e2d05e7f5739440efb781d588a794f2a4fa26403a0b400ef6bfa0d5b1398a6e98ae725392a2cb3a5bcbc1005b8a88cc5e7e4726408876
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/bank-validator.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: bank-validator 0.0.
|
5
|
+
# stub: bank-validator 0.0.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bank-validator"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
data/test/test_bank-validator.rb
CHANGED
@@ -14,38 +14,46 @@ class TestBankValidator < MiniTest::Test
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def save
|
17
|
-
|
17
|
+
if valid?
|
18
|
+
return true
|
19
|
+
else
|
20
|
+
return false
|
21
|
+
end
|
18
22
|
end
|
19
23
|
|
20
24
|
def self.create(attributes = {})
|
21
25
|
new(attributes).save
|
22
26
|
end
|
27
|
+
|
28
|
+
def iban
|
29
|
+
@iban
|
30
|
+
end
|
23
31
|
end
|
24
32
|
|
25
33
|
should "not save if the iban is too short" do
|
26
|
-
assert_equal TestUser.create(iban: "GB82WEST")
|
34
|
+
assert_equal false, TestUser.create(iban: "GB82WEST")
|
27
35
|
end
|
28
36
|
|
29
37
|
should "save if the iban is at least 16 characters" do
|
30
|
-
assert_equal TestUser.create(iban: "GB82WEST12345698765432")
|
38
|
+
assert_equal true, TestUser.create(iban: "GB82WEST12345698765432")
|
31
39
|
end
|
32
40
|
|
33
41
|
should "returns false if the iban does not leave a remainder of 1 when divided by 97" do
|
34
|
-
assert_equal TestUser.create(iban: "GB82WEST123456987654Df")
|
42
|
+
assert_equal false, TestUser.create(iban: "GB82WEST123456987654Df")
|
35
43
|
end
|
36
44
|
|
37
45
|
should "returns true if the iban returns a remainder of 1 when divided by 97" do
|
38
|
-
assert_equal TestUser.create(iban: "GB82WEST12345698765432")
|
46
|
+
assert_equal true, TestUser.create(iban: "GB82WEST12345698765432")
|
39
47
|
end
|
40
48
|
|
41
49
|
should "work for different IBAN formats" do
|
42
50
|
#Belgium
|
43
|
-
assert_equal TestUser.create(iban: "BE62510007547061")
|
51
|
+
assert_equal true, TestUser.create(iban: "BE62510007547061")
|
44
52
|
|
45
53
|
#Bulgaria
|
46
|
-
assert_equal TestUser.create(iban: "BG80BNBG96611020345678")
|
54
|
+
assert_equal true, TestUser.create(iban: "BG80BNBG96611020345678")
|
47
55
|
|
48
56
|
#Germany
|
49
|
-
assert_equal TestUser.create(iban: "DE89370400440532013000")
|
57
|
+
assert_equal true, TestUser.create(iban: "DE89370400440532013000")
|
50
58
|
end
|
51
59
|
end
|