Sha256: 28a94ce0e862ba2ac486eed9e5a6a6ca69ebef2c531bef3669d39614902289a6

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')
require 'rspec/its'

describe Biggs::Format do
  describe '.find' do
    context 'known country with format' do
      subject { Biggs::Format.find('cn') }

      it { is_expected.to be_kind_of(Biggs::Format) }
      its(:country_name) { should eql('China') }
      its(:iso_code) { should eql('cn') }
      its(:format_string) { should eql("{{recipient}}\n{{street}}\n{{postalcode}} {{city}} {{region}}\n{{country}}") }
    end

    context 'known country with unknown format' do
      subject { Biggs::Format.find('af') }

      it { is_expected.to be_kind_of(Biggs::Format) }
      its(:country_name) { should eql('Afghanistan') }
      its(:iso_code) { should eql('af') }
      its(:format_string) { should eql(nil) }
    end

    context 'unknown country' do
      subject { Biggs::Format.find('xx') }

      it { is_expected.to be_kind_of(Biggs::Format) }
      its(:country_name) { should eql(nil) }
      its(:iso_code) { should eql('xx') }
      its(:format_string) { should eql(nil) }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eropple-biggs-0.4.0 spec/unit/format_spec.rb
eropple-biggs-0.3.4 spec/unit/format_spec.rb