Sha256: 0515555e33db0b77c8ea0646a3d64292f23557ce88e297ceda560025d51201d4
Contents?: true
Size: 1.47 KB
Versions: 3
Compression:
Stored size: 1.47 KB
Contents
require 'spec/helper' describe Location do it "should parse city" do test_location("san francisco", "san francisco", nil, nil) end it "should parse city state abbreviation" do test_location("san francisco ca", "san francisco", "CA", nil) end it "should parse city state full" do test_location("san francisco california", "san francisco", "CA", nil) end it "should parse city comma state" do test_location("san francisco, ca", "san francisco", "CA", nil) end it "should parse city state zip" do test_location("san francisco ca 94114-1212", "san francisco", "CA", '94114-1212') end it "should parse city comma state zip" do test_location("san francisco, ca 94114-1212", "san francisco", "CA", '94114-1212') end it "should parse city zip" do test_location("san francisco 94114-1212", "san francisco", nil, '94114-1212') end it "should parse state zip" do test_location("ca 94114-1212", nil, "CA", '94114-1212') end it "should parse state" do test_location("california", nil, "CA", nil) end it "should parse zip" do test_location("94114-1212", nil, nil, '94114-1212') end it "should save raw" do Location.new('san francisco, ca').raw.should == 'san francisco, ca' end private def test_location(str, city, state, zip) l = Location.new(str) l.city.should == city if l.city l.state.to_s(:abbr).should == state.upcase if l.state l.zip.to_s.should == zip if l.zip end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
people_places_things-2.4.1 | spec/location_spec.rb |
people_places_things-2.4.0 | spec/location_spec.rb |
people_places_things-2.3.1 | spec/location_spec.rb |