Sha256: 4c52edef75fb2866a211c4a4255ade21c67394d00bbd25c5c31f5aac9bd6a354

Contents?: true

Size: 738 Bytes

Versions: 3

Compression:

Stored size: 738 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
  
  it "should save raw" do
    State.new('georgia').raw.should == 'georgia'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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