Sha256: 6f7e8f551d3a1569f36e4d246ed4fee93fdb215fb2e9ebeeb91f9a30b728fea4

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

require 'spec/helper'

describe State do
  it "should parse abbreviation" do
    state = State.parse 'ga'
    state.sym.should == :ga
  end

  it "should parse full" do
    state = State.parse 'georgia'
    state.sym.should == :ga
  end

  it "should throw exception on unsupported state" do
    lambda { State.parse('foo') }.should raise_error
  end

  it "should format :abbr" do 
    State.parse('ga').to_s(:abbr).should == 'GA'
  end

  it "should format :full" do 
    State.parse('ga').to_s(:full).should == 'Georgia'
  end

  it "should throw exception on unsupported to_s format" do
    lambda { State.parse('ga').to_s(:bogus) }.should raise_error
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dburkes-people_places_things-1.3.0 spec/state_spec.rb