Sha256: eed0e210cf64009f1615829f6f3d09f322496dff6298ad7fe39bccf7ab1fa6ba

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 KB

Contents

require "spec_helper"
require_relative "shared_examples_for_to_remove_all_masks"

RSpec.describe BrDocuments::IE::MT do
  describe "#formatted" do
    it "returns a formatted ie" do
      ie = described_class.new("12345678901")
      expect(ie.formatted).to eq "1234567890-1"
    end
  end

  describe "#valid?" do
    it "is invalid with malformed number" do
      ["82.060.187.373", "528843171-72", "AD402552219"].each do |number|
        ie = described_class.new(number)
        expect(ie).to_not be_valid
      end
    end

    context "when the number is greater than 11" do
      subject { described_class.new("123456789012") }

      it "is invalid" do
        expect(subject).to_not be_valid
      end
    end

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

    it "is valid with valid number" do
      ["0013000001-9", "82060187373", "132631946", "13.263.194-6"].each do |number|
        ie = described_class.new(number)
        expect(ie).to be_valid
      end
    end

    include_examples "for to remove all masks", "0013000001-9"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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