geographer 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2009 C. Jason Harrelson (midas)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,93 @@
1
+ = geographer
2
+
3
+ == DESCRIPTION
4
+
5
+ Provides Geography information from the US and world (ie. US states list with abbreviations and names, World
6
+ countries list, etc.)
7
+
8
+
9
+ == FEATURES
10
+
11
+ * States class containing information about the US states and territories.
12
+
13
+
14
+ == PLANNED FEATURES
15
+
16
+ * World countries list
17
+ * US zip codes list and tools
18
+
19
+
20
+ == INSTALL
21
+
22
+ gem sources -a http://gemcutter.org
23
+ sudo gem install
24
+
25
+
26
+ == INSTALL FOR RAILS
27
+
28
+ Add to environment file:
29
+
30
+ config.gem "geographer", :version => '1.0.0', :source => 'http://gemcutter.org'
31
+
32
+ You may also want to create an initializer at config/initilaizer/geographer.rb:
33
+
34
+ $STATES = Geographer::Us::States
35
+
36
+ This will allow you to use $STATES as opposed to Geographer::Us::States when using geographer within your application.
37
+
38
+
39
+ == USAGE
40
+
41
+ For a list (array) of state abbreviations:
42
+
43
+ Geographer::Us::States.abbreviations
44
+
45
+ For a list (array) of state names:
46
+
47
+ Geographer::Us::States.names
48
+
49
+ For a list (array) of state abbreviations with US territories:
50
+
51
+ Geographer::Us::States.abbreviations_with_territories
52
+
53
+ For a list (array) of state names with US territories:
54
+
55
+ Geographer::Us::States.names_with_territories
56
+
57
+ For a list (array) of territory abbreviations:
58
+
59
+ Geographer::Us::States.territories_abbreviations
60
+
61
+ For a list (array) of territory names:
62
+
63
+ Geographer::Us::States.territories_names
64
+
65
+ To look up the full name from the abbreviation:
66
+
67
+ Geographer::Us::States.abbreviations_name_map['AL'] # returns 'Alabama'
68
+
69
+
70
+ == LICENSE
71
+
72
+ (The MIT License)
73
+
74
+ Copyright (c) 2009 C. Jason Harrelson (midas)
75
+
76
+ Permission is hereby granted, free of charge, to any person obtaining
77
+ a copy of this software and associated documentation files (the
78
+ 'Software'), to deal in the Software without restriction, including
79
+ without limitation the rights to use, copy, modify, merge, publish,
80
+ distribute, sublicense, and/or sell copies of the Software, and to
81
+ permit persons to whom the Software is furnished to do so, subject to
82
+ the following conditions:
83
+
84
+ The above copyright notice and this permission notice shall be
85
+ included in all copies or substantial portions of the Software.
86
+
87
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
88
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
89
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
90
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
91
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
92
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
93
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "geographer"
8
+ gem.summary = %Q{Provides Geography information from the US and world (ie. US states list with abbreviations and names, World countries list, etc.)}
9
+ gem.description = %Q{Provides Geography information from the US and world (ie. US states list with abbreviations and names, World countries list, etc.)}
10
+ gem.email = "jason@lookforwardenterprises.com"
11
+ gem.homepage = "http://github.com/midas/geographer"
12
+ gem.authors = ["C. Jason Harrelson (midas)"]
13
+ gem.add_development_dependency "shoulda", ">= 2.10.2"
14
+ end
15
+ Jeweler::GemcutterTasks.new
16
+ rescue LoadError
17
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
18
+ end
19
+
20
+ require 'rake/testtask'
21
+ Rake::TestTask.new(:test) do |test|
22
+ test.libs << 'lib' << 'test'
23
+ test.pattern = 'test/**/*_test.rb'
24
+ test.verbose = true
25
+ end
26
+
27
+ begin
28
+ require 'rcov/rcovtask'
29
+ Rcov::RcovTask.new do |test|
30
+ test.libs << 'test'
31
+ test.pattern = 'test/**/*_test.rb'
32
+ test.verbose = true
33
+ end
34
+ rescue LoadError
35
+ task :rcov do
36
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
37
+ end
38
+ end
39
+
40
+ task :test => :check_dependencies
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ if File.exist?('VERSION')
47
+ version = File.read('VERSION')
48
+ else
49
+ version = ""
50
+ end
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "geographer #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,57 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{geographer}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["C. Jason Harrelson (midas)"]
12
+ s.date = %q{2009-10-21}
13
+ s.description = %q{Provides Geography information from the US and world (ie. US states list with abbreviations and names, World countries list, etc.)}
14
+ s.email = %q{jason@lookforwardenterprises.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".gitignore",
22
+ "LICENSE",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "geographer.gemspec",
27
+ "lib/geographer.rb",
28
+ "lib/geographer/us/states.rb",
29
+ "script/console",
30
+ "test/geographer/us/states_test.rb",
31
+ "test/geographer_test.rb",
32
+ "test/test_helper.rb"
33
+ ]
34
+ s.homepage = %q{http://github.com/midas/geographer}
35
+ s.rdoc_options = ["--charset=UTF-8"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = %q{1.3.5}
38
+ s.summary = %q{Provides Geography information from the US and world (ie. US states list with abbreviations and names, World countries list, etc.)}
39
+ s.test_files = [
40
+ "test/geographer/us/states_test.rb",
41
+ "test/geographer_test.rb",
42
+ "test/test_helper.rb"
43
+ ]
44
+
45
+ if s.respond_to? :specification_version then
46
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
+ s.specification_version = 3
48
+
49
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
+ s.add_development_dependency(%q<shoulda>, [">= 2.10.2"])
51
+ else
52
+ s.add_dependency(%q<shoulda>, [">= 2.10.2"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<shoulda>, [">= 2.10.2"])
56
+ end
57
+ end
@@ -0,0 +1,109 @@
1
+ module Geographer
2
+ module Us
3
+
4
+ # Provides a list of US States abbreviations (with and without territories), names and a map of
5
+ # abbreviations to names.
6
+ #
7
+ class States
8
+
9
+ # A list of abbreviatons of US States and territories.
10
+ #
11
+ def self.abbreviations
12
+ self.abbreviations_with_territories - self.territories_abbreviations
13
+ end
14
+
15
+ # A list of names of US States only (no territories).
16
+ #
17
+ def self.names
18
+ self.names_with_territories - self.territories_names
19
+ end
20
+
21
+ # A list of abbreviatons of US States and territories.
22
+ #
23
+ def self.abbreviations_with_territories
24
+ self.abbreviations_name_map.keys.sort
25
+ end
26
+
27
+ # A list of names of US States and territories.
28
+ #
29
+ def self.names_with_territories
30
+ self.abbreviations_name_map.values.sort
31
+ end
32
+
33
+ # A list of abbreviatons of US territories.
34
+ #
35
+ def self.territories_abbreviations
36
+ %w( AS FM GU MH PW PR VI )
37
+ end
38
+
39
+ def self.territories_names
40
+ [ "American Samoa", "Guam", "Islands", "Micronesia", "Palau", "Puerto Rico", "Virgin Island" ]
41
+ end
42
+
43
+ # An index (map) of US States and territories abbreviations and full names.
44
+ #
45
+ def self.abbreviations_name_map
46
+ {
47
+ 'AL' => 'Alabama',
48
+ 'AK' => 'Alaska',
49
+ 'AS' => 'American Samoa',
50
+ 'AZ' => 'Arizona',
51
+ 'AR' => 'Arkansas',
52
+ 'CA' => 'California',
53
+ 'CO' => 'Colorado',
54
+ 'CT' => 'Connecticut',
55
+ 'DE' => 'Delaware',
56
+ 'DC' => 'District of Columbia',
57
+ 'FM' => 'Micronesia',
58
+ 'FL' => 'Florida',
59
+ 'GA' => 'Georgia',
60
+ 'GU' => 'Guam',
61
+ 'HI' => 'Hawaii',
62
+ 'ID' => 'Idaho',
63
+ 'IL' => 'Illinois',
64
+ 'IN' => 'Indiana',
65
+ 'IA' => 'Iowa',
66
+ 'KS' => 'Kansas',
67
+ 'KY' => 'Kentucky',
68
+ 'LA' => 'Louisiana',
69
+ 'ME' => 'Maine',
70
+ 'MH' => 'Islands',
71
+ 'MD' => 'Maryland',
72
+ 'MA' => 'Massachusetts',
73
+ 'MI' => 'Michigan',
74
+ 'MN' => 'Minnesota',
75
+ 'MS' => 'Mississippi',
76
+ 'MO' => 'Missouri',
77
+ 'MT' => 'Montana',
78
+ 'NE' => 'Nebraska',
79
+ 'NV' => 'Nevada',
80
+ 'NH' => 'New Hampshire',
81
+ 'NJ' => 'New Jersey',
82
+ 'NM' => 'New Mexico',
83
+ 'NY' => 'New York',
84
+ 'NC' => 'North Carolina',
85
+ 'ND' => 'North Dakota',
86
+ 'OH' => 'Ohio',
87
+ 'OK' => 'Oklahoma',
88
+ 'OR' => 'Oregon',
89
+ 'PW' => 'Palau',
90
+ 'PA' => 'Pennsylvania',
91
+ 'PR' => 'Puerto Rico',
92
+ 'RI' => 'Rhode Island',
93
+ 'SC' => 'South Carolina',
94
+ 'SD' => 'South Dakota',
95
+ 'TN' => 'Tennessee',
96
+ 'TX' => 'Texas',
97
+ 'UT' => 'Utah',
98
+ 'VT' => 'Vermont',
99
+ 'VI' => 'Virgin Island',
100
+ 'VA' => 'Virginia',
101
+ 'WA' => 'Washington',
102
+ 'WV' => 'West Virginia',
103
+ 'WI' => 'Wisconsin',
104
+ 'WY' => 'Wyoming'
105
+ }
106
+ end
107
+ end
108
+ end
109
+ end
data/lib/geographer.rb ADDED
@@ -0,0 +1,8 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ require 'geographer/us/states'
5
+
6
+ module Geographer
7
+ VERSION = '1.0.0'
8
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/geographer.rb'}"
9
+ puts "Loading geographer gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,297 @@
1
+ require 'test_helper'
2
+
3
+ class StatesTest < Test::Unit::TestCase
4
+ context "states" do
5
+ context "abbreviations" do
6
+ setup do
7
+ @states = %w( AK AL AR AZ CA CO CT DC DE FL GA HI IA ID IL IN KS KY LA MA MD ME MI MN MO MS MT NC ND NE NH NJ NM NV NY
8
+ OH OK OR PA RI SC SD TN TX UT VA VT WA WI WV WY )
9
+ @territories = %w( AS FM GU MH PW PR VI )
10
+ @all = @states + @territories
11
+
12
+ assert_equal 51, @states.size
13
+ assert_equal 7, @territories.size
14
+ assert_equal 58, @all.size
15
+ end
16
+
17
+ should "agree with list of states abbreviations" do
18
+ assert_same_elements @states, States.abbreviations
19
+ end
20
+
21
+ should "agree with list of territories abbreviations" do
22
+ assert_same_elements @territories, States.territories_abbreviations
23
+ end
24
+
25
+ should "agree with list of states and territories abbreviations" do
26
+ assert_same_elements @all, States.abbreviations_with_territories
27
+ end
28
+ end
29
+
30
+ context "names" do
31
+ setup do
32
+ @states = [ "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware",
33
+ "District of Columbia", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas",
34
+ "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri",
35
+ "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina",
36
+ "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota",
37
+ "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming" ]
38
+ @territories = [ "American Samoa", "Guam", "Islands", "Micronesia", "Palau","Puerto Rico", "Virgin Island" ]
39
+ @all = @states + @territories
40
+
41
+ assert_equal 51, @states.size
42
+ assert_equal 7, @territories.size
43
+ assert_equal 58, @all.size
44
+ end
45
+
46
+ should "agree with list of states names" do
47
+ assert_same_elements @states, States.names
48
+ end
49
+
50
+ should "agree with list of territories names" do
51
+ assert_same_elements @territories, States.territories_names
52
+ end
53
+
54
+ should "agree with list of states and territories names" do
55
+ assert_same_elements @all, States.names_with_territories
56
+ end
57
+ end
58
+
59
+ context "map" do
60
+ context "states" do
61
+ should "agree that AL is Alabama" do
62
+ assert_equal 'Alabama', States.abbreviations_name_map[ 'AL' ]
63
+ end
64
+
65
+ should "agree that AK is Alaska" do
66
+ assert_equal 'Alaska', States.abbreviations_name_map[ 'AK' ]
67
+ end
68
+
69
+ should "agree that AZ is Arizona" do
70
+ assert_equal 'Arizona', States.abbreviations_name_map[ 'AZ' ]
71
+ end
72
+
73
+ should "agree that AR is Arkansas" do
74
+ assert_equal 'Arkansas', States.abbreviations_name_map[ 'AR' ]
75
+ end
76
+
77
+ should "agree that CA is California" do
78
+ assert_equal 'California', States.abbreviations_name_map[ 'CA' ]
79
+ end
80
+
81
+ should "agree that CO is Colorado" do
82
+ assert_equal 'Colorado', States.abbreviations_name_map[ 'CO' ]
83
+ end
84
+
85
+ should "agree that CT is Connecticut" do
86
+ assert_equal 'Connecticut', States.abbreviations_name_map[ 'CT' ]
87
+ end
88
+
89
+ should "agree that DE is Delaware" do
90
+ assert_equal 'Delaware', States.abbreviations_name_map[ 'DE' ]
91
+ end
92
+
93
+ should "agree that DC is District of Columbia" do
94
+ assert_equal 'District of Columbia', States.abbreviations_name_map[ 'DC' ]
95
+ end
96
+
97
+ should "agree that FL is Florida" do
98
+ assert_equal 'Florida', States.abbreviations_name_map[ 'FL' ]
99
+ end
100
+
101
+ should "agree that GA is Georgia" do
102
+ assert_equal 'Georgia', States.abbreviations_name_map[ 'GA' ]
103
+ end
104
+
105
+ should "agree that HI is Hawaii" do
106
+ assert_equal 'Hawaii', States.abbreviations_name_map[ 'HI' ]
107
+ end
108
+
109
+ should "agree that ID is Idaho" do
110
+ assert_equal 'Idaho', States.abbreviations_name_map[ 'ID' ]
111
+ end
112
+
113
+ should "agree that IL is Illinois" do
114
+ assert_equal 'Illinois', States.abbreviations_name_map[ 'IL' ]
115
+ end
116
+
117
+ should "agree that IN is Indiana" do
118
+ assert_equal 'Indiana', States.abbreviations_name_map[ 'IN' ]
119
+ end
120
+
121
+ should "agree that IA is Iowa" do
122
+ assert_equal 'Iowa', States.abbreviations_name_map[ 'IA' ]
123
+ end
124
+
125
+ should "agree that KS is Kansas" do
126
+ assert_equal 'Kansas', States.abbreviations_name_map[ 'KS' ]
127
+ end
128
+
129
+ should "agree that KY is Kentucky" do
130
+ assert_equal 'Kentucky', States.abbreviations_name_map[ 'KY' ]
131
+ end
132
+
133
+ should "agree that LA is Louisiana" do
134
+ assert_equal 'Louisiana', States.abbreviations_name_map[ 'LA' ]
135
+ end
136
+
137
+ should "agree that ME is Maine" do
138
+ assert_equal 'Maine', States.abbreviations_name_map[ 'ME' ]
139
+ end
140
+
141
+ should "agree that MD is Maryland" do
142
+ assert_equal 'Maryland', States.abbreviations_name_map[ 'MD' ]
143
+ end
144
+
145
+ should "agree that MA is Massachusetts" do
146
+ assert_equal 'Massachusetts', States.abbreviations_name_map[ 'MA' ]
147
+ end
148
+
149
+ should "agree that MI is Michigan" do
150
+ assert_equal 'Michigan', States.abbreviations_name_map[ 'MI' ]
151
+ end
152
+
153
+ should "agree that MN is Minnesota" do
154
+ assert_equal 'Minnesota', States.abbreviations_name_map[ 'MN' ]
155
+ end
156
+
157
+ should "agree that MS is Mississippi" do
158
+ assert_equal 'Mississippi', States.abbreviations_name_map[ 'MS' ]
159
+ end
160
+
161
+ should "agree that MO is Missouri" do
162
+ assert_equal 'Missouri', States.abbreviations_name_map[ 'MO' ]
163
+ end
164
+
165
+ should "agree that MT is Montana" do
166
+ assert_equal 'Montana', States.abbreviations_name_map[ 'MT' ]
167
+ end
168
+
169
+ should "agree that NE is Nebraska" do
170
+ assert_equal 'Nebraska', States.abbreviations_name_map[ 'NE' ]
171
+ end
172
+
173
+ should "agree that NV is Nevada" do
174
+ assert_equal 'Nevada', States.abbreviations_name_map[ 'NV' ]
175
+ end
176
+
177
+ should "agree that NH is New Hampshire" do
178
+ assert_equal 'New Hampshire', States.abbreviations_name_map[ 'NH' ]
179
+ end
180
+
181
+ should "agree that NJ is New Jersey" do
182
+ assert_equal 'New Jersey', States.abbreviations_name_map[ 'NJ' ]
183
+ end
184
+
185
+ should "agree that NM is New Mexico" do
186
+ assert_equal 'New Mexico', States.abbreviations_name_map[ 'NM' ]
187
+ end
188
+
189
+ should "agree that NY is New York" do
190
+ assert_equal 'New York', States.abbreviations_name_map[ 'NY' ]
191
+ end
192
+
193
+ should "agree that NC is North Carolina" do
194
+ assert_equal 'North Carolina', States.abbreviations_name_map[ 'NC' ]
195
+ end
196
+
197
+ should "agree that ND is North Dakota" do
198
+ assert_equal 'North Dakota', States.abbreviations_name_map[ 'ND' ]
199
+ end
200
+
201
+ should "agree that OH is Ohio" do
202
+ assert_equal 'Ohio', States.abbreviations_name_map[ 'OH' ]
203
+ end
204
+
205
+ should "agree that OK is Oklahoma" do
206
+ assert_equal 'Oklahoma', States.abbreviations_name_map[ 'OK' ]
207
+ end
208
+
209
+ should "agree that OR is Oregon" do
210
+ assert_equal 'Oregon', States.abbreviations_name_map[ 'OR' ]
211
+ end
212
+
213
+ should "agree that PA is Pennsylvania" do
214
+ assert_equal 'Pennsylvania', States.abbreviations_name_map[ 'PA' ]
215
+ end
216
+
217
+ should "agree that RI is Rhode Island" do
218
+ assert_equal 'Rhode Island', States.abbreviations_name_map[ 'RI' ]
219
+ end
220
+
221
+ should "agree that SC is South Carolina" do
222
+ assert_equal 'South Carolina', States.abbreviations_name_map[ 'SC' ]
223
+ end
224
+
225
+ should "agree that SD is South Dakota" do
226
+ assert_equal 'South Dakota', States.abbreviations_name_map[ 'SD' ]
227
+ end
228
+
229
+ should "agree that TN is Tennessee" do
230
+ assert_equal 'Tennessee', States.abbreviations_name_map[ 'TN' ]
231
+ end
232
+
233
+ should "agree that TX is Texas" do
234
+ assert_equal 'Texas', States.abbreviations_name_map[ 'TX' ]
235
+ end
236
+
237
+ should "agree that UT is Utah" do
238
+ assert_equal 'Utah', States.abbreviations_name_map[ 'UT' ]
239
+ end
240
+
241
+ should "agree that VT is Vermont" do
242
+ assert_equal 'Vermont', States.abbreviations_name_map[ 'VT' ]
243
+ end
244
+
245
+ should "agree that VA is Virginia" do
246
+ assert_equal 'Virginia', States.abbreviations_name_map[ 'VA' ]
247
+ end
248
+
249
+ should "agree that WA is Washington" do
250
+ assert_equal 'Washington', States.abbreviations_name_map[ 'WA' ]
251
+ end
252
+
253
+ should "agree that WV is West Virginia" do
254
+ assert_equal 'West Virginia', States.abbreviations_name_map[ 'WV' ]
255
+ end
256
+
257
+ should "agree that WI is Wisconsin" do
258
+ assert_equal 'Wisconsin', States.abbreviations_name_map[ 'WI' ]
259
+ end
260
+
261
+ should "agree that WY is Wyoming" do
262
+ assert_equal 'Wyoming', States.abbreviations_name_map[ 'WY' ]
263
+ end
264
+ end
265
+
266
+ context "territories" do
267
+ should "agree that AS is American Samoa" do
268
+ assert_equal 'American Samoa', States.abbreviations_name_map[ 'AS' ]
269
+ end
270
+
271
+ should "agree that GU is Guam" do
272
+ assert_equal 'Guam', States.abbreviations_name_map[ 'GU' ]
273
+ end
274
+
275
+ should "agree that FM is Micronesia" do
276
+ assert_equal 'Micronesia', States.abbreviations_name_map[ 'FM' ]
277
+ end
278
+
279
+ should "agree that MH is Islands" do
280
+ assert_equal 'Islands', States.abbreviations_name_map[ 'MH' ]
281
+ end
282
+
283
+ should "agree that PW is Palau" do
284
+ assert_equal 'Palau', States.abbreviations_name_map[ 'PW' ]
285
+ end
286
+
287
+ should "agree that PR is Puerto Rico" do
288
+ assert_equal 'Puerto Rico', States.abbreviations_name_map[ 'PR' ]
289
+ end
290
+
291
+ should "agree that VI is Virgin Island" do
292
+ assert_equal 'Virgin Island', States.abbreviations_name_map[ 'VI' ]
293
+ end
294
+ end
295
+ end
296
+ end
297
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class GeographerTest < Test::Unit::TestCase
4
+ should "be true" do
5
+ assert true
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'geographer'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: geographer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - C. Jason Harrelson (midas)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-21 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.10.2
24
+ version:
25
+ description: Provides Geography information from the US and world (ie. US states list with abbreviations and names, World countries list, etc.)
26
+ email: jason@lookforwardenterprises.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - .document
36
+ - .gitignore
37
+ - LICENSE
38
+ - README.rdoc
39
+ - Rakefile
40
+ - VERSION
41
+ - geographer.gemspec
42
+ - lib/geographer.rb
43
+ - lib/geographer/us/states.rb
44
+ - script/console
45
+ - test/geographer/us/states_test.rb
46
+ - test/geographer_test.rb
47
+ - test/test_helper.rb
48
+ has_rdoc: true
49
+ homepage: http://github.com/midas/geographer
50
+ licenses: []
51
+
52
+ post_install_message:
53
+ rdoc_options:
54
+ - --charset=UTF-8
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
62
+ version:
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.3.5
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: Provides Geography information from the US and world (ie. US states list with abbreviations and names, World countries list, etc.)
76
+ test_files:
77
+ - test/geographer/us/states_test.rb
78
+ - test/geographer_test.rb
79
+ - test/test_helper.rb