bank-validator 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 137cabc680b6f14aeea6ee151183e91efe53f68c
4
- data.tar.gz: 2ae243a0d7e1a13561fc3fa3c656c1dc0fc81b3c
3
+ metadata.gz: 73aa72dcb3b94f3f1c58f0c996406c7931eecbcd
4
+ data.tar.gz: f1ec617013e30ffe8e8be14aa09ae97c163dc63e
5
5
  SHA512:
6
- metadata.gz: 5b0a258e72ebb542061939e2783aac6077e7ff9fd7182e0afa3e7b3f0056cf25b3ed8d508ba0782320012baef6676ddc3f829f7f657dcd4ba28ddf49e0501275
7
- data.tar.gz: ca4413c23066c6c648a73bb59571f168656ad9e4e5806a46d1dec66e2b825112f1793a6728bedcc9c8e48f5e8e0c82ff2ddc268ca7e335fe1d50cb6846a88295
6
+ metadata.gz: 6c12eb467855a4f70b83ef4c43ed3e5fd4ac2955a16041dc8ac82f729821621b1e2da68ed753af965481848c98e642e2a7a5226368d22ca372ec7ea2a98451bb
7
+ data.tar.gz: 38018cdf9bc96940426dc25c18cd2dfe6a3eb5aec3538be8e710ffa985691043415011e1246ffd2388fd9a4ccadac7d9a468eac42febbe1f603f27722a9e465b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -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 ruby lib
5
+ # stub: bank-validator 0.0.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "bank-validator"
9
- s.version = "0.0.5"
9
+ s.version = "0.0.6"
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"]
@@ -18,13 +18,12 @@ class IbanValidator < ActiveModel::EachValidator
18
18
 
19
19
  def valid_iban?(iban)
20
20
  # Move first four characters to end of string
21
- first_four_chars = iban.slice!(0..3)
22
- iban += first_four_chars
21
+ dummy_iban = iban.slice(4..-1) + iban.slice(0..3)
23
22
 
24
23
  # Substitute all letters with integers
25
- iban.split(//).each { |char| iban.gsub!(char, (char.downcase.ord - 87).to_s) if (char =~ /[a-zA-Z]/).present? }
24
+ dummy_iban.split(//).each { |char| dummy_iban.gsub!(char, (char.downcase.ord - 87).to_s) if (char =~ /[a-zA-Z]/).present? }
26
25
 
27
26
  # Check if division by 97 yields a remainder of 1, in which case it could be a valid IBAN
28
- (iban.to_i % 97) == 1
27
+ (dummy_iban.to_i % 97) == 1
29
28
  end
30
29
  end
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: ~/Workspace/bank-validator
3
3
  specs:
4
- bank-validator (0.0.4)
4
+ bank-validator (0.0.5)
5
+ activemodel (>= 3.0)
5
6
  activerecord (>= 3.0)
6
7
  activesupport (>= 3.0)
7
8
 
@@ -19,4 +19,9 @@ RSpec.describe 'testing the gem', type: :feature do
19
19
  @user.iban = 'BE62510007547061'
20
20
  expect(@user.save).to be(true)
21
21
  end
22
+
23
+ it 'creates a user with full iban' do
24
+ user = User.create(name: 'Adam', iban: 'BE62510007547061')
25
+ expect(user.iban).to eq('BE62510007547061')
26
+ end
22
27
  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.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Bahlke