X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/baf9ff0ec39c13f52ee8d4f087641dc5fcc9c53b..fcc68b4dc198b7cb0cf93467d96038b0844675fe:/vendor/plugins/geokit/test/geoloc_test.rb diff --git a/vendor/plugins/geokit/test/geoloc_test.rb b/vendor/plugins/geokit/test/geoloc_test.rb new file mode 100644 index 0000000..5cf6411 --- /dev/null +++ b/vendor/plugins/geokit/test/geoloc_test.rb @@ -0,0 +1,49 @@ +require 'test/unit' +require File.join(File.dirname(__FILE__), '../../../../config/environment') + +class GeoLocTest < Test::Unit::TestCase #:nodoc: all + + def setup + @loc = GeoKit::GeoLoc.new + end + + def test_is_us + assert !@loc.is_us? + @loc.country_code = 'US' + assert @loc.is_us? + end + + def test_street_number + @loc.street_address = '123 Spear St.' + assert_equal '123', @loc.street_number + end + + def test_street_name + @loc.street_address = '123 Spear St.' + assert_equal 'Spear St.', @loc.street_name + end + + def test_city + @loc.city = "san francisco" + assert_equal 'San Francisco', @loc.city + end + + def test_full_address + @loc.city = 'San Francisco' + @loc.state = 'CA' + @loc.zip = '94105' + @loc.country_code = 'US' + assert_equal 'San Francisco, CA, 94105, US', @loc.full_address + @loc.full_address = 'Irving, TX, 75063, US' + assert_equal 'Irving, TX, 75063, US', @loc.full_address + end + + def test_hash + @loc.city = 'San Francisco' + @loc.state = 'CA' + @loc.zip = '94105' + @loc.country_code = 'US' + @another = GeoKit::GeoLoc.new @loc.to_hash + assert_equal @loc, @another + end +end \ No newline at end of file