Sha256: 72619bd4b71fed5901441ea8ed539322043db3ba7e9946d226a12f35c0bf6eb5

Contents?: true

Size: 605 Bytes

Versions: 7

Compression:

Stored size: 605 Bytes

Contents

require "spec_helper"
require "banktools-se/utils"

describe BankTools::SE::Utils, "valid_luhn?" do

  [
    "00",
    "18",
    "26",
    "34",
    "42",
    "59",
    "67",
    "75",
    "83",
    "91",
    "109",
    "117",
    "5402-9681",
  ].each do |number|
    it "should allow a valid number like #{number}" do
      BankTools::SE::Utils.valid_luhn?(number).should eq(true)
    end
  end

  [
    "01",
    "118",
    "5402-9682",
  ].each do |number|
    it "should disallow an invalid number like #{number}" do
      BankTools::SE::Utils.valid_luhn?(number).should eq(false)
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
banktools-se-2.5.0 spec/utils_spec.rb
banktools-se-2.4.0 spec/utils_spec.rb
banktools-se-2.3.0 spec/utils_spec.rb
banktools-se-2.1.0 spec/utils_spec.rb
banktools-se-2.0.0 spec/utils_spec.rb
banktools-se-1.0.0 spec/utils_spec.rb
banktools-se-0.11.0 spec/utils_spec.rb