Sha256: a093fd5593282c911594221317a5afe48c4ba81698357bf1013d6ba7e8251e1f

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')

describe Biggs::Format do
  describe ".find" do
    context "known country with format" do
      subject { Biggs::Format.find("cn") }
      
      it{ should 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{{zip}} {{city}} {{state}}\n{{country}}") }
    end
    
    context "known country with unknown format" do
      subject { Biggs::Format.find("af") }
      
      it{ should 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{ should 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

9 entries across 9 versions & 1 rubygems

Version Path
biggs-0.7.0 spec/unit/format_spec.rb
biggs-0.6.0 spec/unit/format_spec.rb
biggs-0.5.1 spec/unit/format_spec.rb
biggs-0.5.0 spec/unit/format_spec.rb
biggs-0.4.0 spec/unit/format_spec.rb
biggs-0.3.3 spec/unit/format_spec.rb
biggs-0.3.2 spec/unit/format_spec.rb
biggs-0.3.1 spec/unit/format_spec.rb
biggs-0.3.0 spec/unit/format_spec.rb