Sha256: e8c1b81a3482705931e5a607dc03c97d8ed8741945601ccef95ddbb51f80cc49

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

RSpec.describe GovKit::CA::PostalCode::Strategy::DigitalCopyrightCa do
  describe '#electoral_districts' do
    it 'should return the electoral districts within a postal code' do
      { 'G0C2Y0' => [24019, 24039], # too many 24019
        'T5S2B9' => [48012, 48013, 48014, 48015, 48017, 48018], # too many 48015
        'B0J2L0' => [12002, 12007, 12008],
        'K0A1K0' => [35025, 35052, 35063],
      }.each do |postal_code,electoral_districts|
        expect(GovKit::CA::PostalCode::Strategy::DigitalCopyrightCa.new(postal_code).electoral_districts).to eq(electoral_districts)
      end
    end

    it 'should return false if a postal code contains no electoral districts' do
      expect(GovKit::CA::PostalCode::Strategy::DigitalCopyrightCa.new('H0H0H0').electoral_districts).to eq(false)
    end

    it 'should return false if a postal code does not exist' do
      expect(GovKit::CA::PostalCode::Strategy::DigitalCopyrightCa.new('X1B1B1').electoral_districts).to eq(false)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
govkit-ca-0.0.12 spec/digital-copyright_ca_spec.rb