Sha256: 38189794b9e797646d95536b827d5183d24ccd89bea681294fb552bdfc52a830

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

require "spec_helper"
require_relative "shared_examples_for_to_remove_all_masks"

describe BrDocuments::IE::RS do
  describe "#formatted" do
    it "returns a formatted ie" do
      ie = described_class.new("1234567890")
      expect(ie.formatted).to eq "123/4567890"
    end
  end

  describe "#valid?" do
    it "is invalid with malformed number" do
      ie = described_class.new("17/70169293")
      expect(ie).to_not be_valid
    end

    it "is invalid with length different to 10" do
      ["123456789", "12345678901"].each do |number|
        ie = described_class.new(number)
        expect(ie).to_not be_valid
      end
    end

    it "is invalid with invalid check number" do
      ["1770169292", "034/0112114"].each do |number|
        ie = described_class.new(number)
        expect(ie).to_not be_valid
      end
    end

    it "is valid with valid number" do
      ["1770169293", "034/0112115"].each do |number|
        ie = described_class.new(number)
        expect(ie).to be_valid
      end
    end

    include_examples "for to remove all masks", "034/0112115"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
br_documents-0.1.3 spec/ie/rs_spec.rb
br_documents-0.1.2 spec/ie/rs_spec.rb
br_documents-0.1.1 spec/ie/rs_spec.rb
br_documents-0.1.0 spec/ie/rs_spec.rb
br_documents-0.0.15 spec/ie/rs_spec.rb
br_documents-0.0.14 spec/ie/rs_spec.rb
br_documents-0.0.13 spec/ie/rs_spec.rb
br_documents-0.0.12 spec/ie/rs_spec.rb
br_documents-0.0.11 spec/ie/rs_spec.rb