Sha256: df579fbff427e51ffaf1b12b8dcee1f1eb2c35856fc8eaa99887a2c42819a557

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

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

RSpec.describe GovKit::CA::PostalCode::Strategy::LiberalCa do
  describe '#electoral_districts' do
    it 'should return the electoral districts within a postal code' do
      { 'G0C2Y0' => [24026],
        'T5S2B9' => [48031],
        'B0J2L0' => [12002], # too few
        'K0A1K0' => [35076], # too few
      }.each do |postal_code,electoral_districts|
        expect(GovKit::CA::PostalCode::Strategy::LiberalCa.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::LiberalCa.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::LiberalCa.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/liberal_ca_spec.rb