Sha256: b48cb5b0f05d8ee4d4f25f8ba29b6b57ca498850912b6f0b83a0636aa657cf1d

Contents?: true

Size: 784 Bytes

Versions: 3

Compression:

Stored size: 784 Bytes

Contents

require 'spec/helper'

describe ZipCode do
  it "should parse base" do
    zip = ZipCode.new '30306'
    zip.base.should == '30306'
    zip.plus_four.should == nil
  end

  it "should parse plus four" do
    zip = ZipCode.new '30306-3522'
    zip.base.should == '30306'
    zip.plus_four.should == '3522'
  end
  
  it "should throw exception on unsupported parse format" do
    lambda { ZipCode.new('303065344') }.should raise_error
  end

  it "should convert to string" do 
    ZipCode.new('30306-3522').to_s.should == '30306-3522'
  end

  it "should throw exception on unsupported to_s format" do
    lambda { ZipCode.new('30306-3522').to_s(:bogus) }.should raise_error
  end
  
  it "should save raw format" do
    ZipCode.new('30306-3522').raw.should == '30306-3522'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
people_places_things-2.4.1 spec/zip_code_spec.rb
people_places_things-2.4.0 spec/zip_code_spec.rb
people_places_things-2.3.1 spec/zip_code_spec.rb