bank-validator 0.0.3 → 0.0.4

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: 3ce014a1251785320e4a3942f9509d9c5df8a167
4
- data.tar.gz: 9434a9d5af76a0b4c6ca946b1a8b53b0a2eac0bc
3
+ metadata.gz: 1a46fbc13a9cac58d289a439168a4ecdab0e9fa8
4
+ data.tar.gz: 15b35484a766720f8fd2a3651014bddb0793714b
5
5
  SHA512:
6
- metadata.gz: d683e2d10cdd64df4d0a0b37de9154abf5a5960d86ea50343bb8d8ab73a7786ca554a4dc0d970df0bdb66906b08d65115f78b4d611846ddee7db35cea6317e2e
7
- data.tar.gz: e404e316bf5c14f03f3d6bafe9cd7387ec5de1d278894b1302b08824e1b70df9b1f65eb5dc968c96f0d1c5774271b3a4a4d0dae6bfacaeed62eb0851c29ba843
6
+ metadata.gz: d100a081f72f95deb1e07fc40bd4f822089489563973110bd1937153266ca387b47d6af93340c1b90cef36b465eb62bcbbdd5cdb4e912ed8bf1945ee2f1dee5d
7
+ data.tar.gz: 5c73fe4cdcc43fc4d91e2d05e7f5739440efb781d588a794f2a4fa26403a0b400ef6bfa0d5b1398a6e98ae725392a2cb3a5bcbc1005b8a88cc5e7e4726408876
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -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.3 ruby lib
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.3"
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"]
@@ -9,7 +9,7 @@ class IbanValidator < ActiveModel::EachValidator
9
9
  private
10
10
 
11
11
  def record_error(record, attribute, value)
12
- record.errors.add(attribute, :invalid_iban)#, options.merge!(value: value))
12
+ record.errors.add(attribute, :invalid_iban)
13
13
  end
14
14
 
15
15
  def regexp
@@ -14,38 +14,46 @@ class TestBankValidator < MiniTest::Test
14
14
  end
15
15
 
16
16
  def save
17
- return false unless valid?
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"), false
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"), nilk
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"), false
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"), nil
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"), nil
51
+ assert_equal true, TestUser.create(iban: "BE62510007547061")
44
52
 
45
53
  #Bulgaria
46
- assert_equal TestUser.create(iban: "BG80BNBG96611020345678"), nil
54
+ assert_equal true, TestUser.create(iban: "BG80BNBG96611020345678")
47
55
 
48
56
  #Germany
49
- assert_equal TestUser.create(iban: "DE89370400440532013000"), nil
57
+ assert_equal true, TestUser.create(iban: "DE89370400440532013000")
50
58
  end
51
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bank-validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Bahlke