Sha256: 10c374299fba9410104b0b5ac2766c6b5a9c4a7b3b413538c499a766cef373aa

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"
require_relative "shared_examples_for_to_remove_all_masks"

describe BrDocuments::IE::RJ do
  describe "#formatted" do
    it "returns a formatted ie" do
      ie = described_class.new("12345678")
      expect(ie.formatted).to eq "12.345.67-8"
    end
  end

  describe "#valid?" do
    it "is invalid with malformed number" do
      ["00.55.55.25", "34.09.25-08", "0A220C18"].each do |number|
        ie = described_class.new(number)
        expect(ie).to_not be_valid
      end
    end

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

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

    it "is valid with valid number" do
      ["80172010", "31.864.95-0", "85.994.964"].each do |number|
        ie = described_class.new(number)
        expect(ie).to be_valid
      end
    end

    include_examples "for to remove all masks", "31.864.95-0"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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