Sha256: 78df0a96e47e0d9141b4ce390e7183ce5285a56c8c762c16b397db4ed239eb87

Contents?: true

Size: 654 Bytes

Versions: 5

Compression:

Stored size: 654 Bytes

Contents

require 'spec/helper'

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

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

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

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

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

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

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
dburkes-people_places_things-2.0.0 spec/state_spec.rb
dburkes-people_places_things-2.1.0 spec/state_spec.rb
dburkes-people_places_things-2.2.0 spec/state_spec.rb
dburkes-people_places_things-2.3.0 spec/state_spec.rb
people_places_things-2.3.0 spec/state_spec.rb