geokit-rails 2.3.2 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +80 -0
- data/.gitignore +44 -37
- data/CHANGELOG.md +106 -96
- data/CONFIG.markdown +67 -67
- data/Gemfile +3 -3
- data/MIT-LICENSE +19 -19
- data/README.markdown +726 -726
- data/Rakefile +17 -17
- data/gemfiles/rails7.1.gemfile +11 -0
- data/gemfiles/{rails3.gemfile → rails7.2.gemfile} +7 -7
- data/gemfiles/{rails4.gemfile → rails8.0.gemfile} +7 -8
- data/gemfiles/{rails5.gemfile → rails8.1.gemfile} +7 -8
- data/geokit-rails.gemspec +34 -33
- data/lib/generators/geokit_rails/install_generator.rb +13 -13
- data/lib/generators/templates/geokit_config.rb +100 -100
- data/lib/geokit-rails/acts_as_mappable/class_methods.rb +299 -0
- data/lib/geokit-rails/acts_as_mappable/glue.rb +54 -0
- data/lib/geokit-rails/acts_as_mappable.rb +78 -425
- data/lib/geokit-rails/adapters/abstract.rb +30 -30
- data/lib/geokit-rails/adapters/mysql.rb +21 -21
- data/lib/geokit-rails/adapters/mysql2.rb +8 -8
- data/lib/geokit-rails/adapters/mysql2spatial.rb +8 -8
- data/lib/geokit-rails/adapters/oracleenhanced.rb +32 -32
- data/lib/geokit-rails/adapters/postgresql.rb +21 -21
- data/lib/geokit-rails/adapters/sqlite.rb +53 -53
- data/lib/geokit-rails/adapters/sqlserver.rb +45 -45
- data/lib/geokit-rails/{core_extensions.rb → distance_collection.rb} +8 -8
- data/lib/geokit-rails/geocoder_control.rb +19 -19
- data/lib/geokit-rails/ip_geocode_lookup.rb +44 -48
- data/lib/geokit-rails/railtie.rb +37 -37
- data/lib/geokit-rails/version.rb +3 -3
- data/lib/geokit-rails.rb +11 -9
- data/test/acts_as_mappable_test.rb +486 -478
- data/test/adapter_resolution_test.rb +46 -0
- data/test/boot.rb +40 -32
- data/test/database.yml +31 -28
- data/test/distance_collection_test.rb +42 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/stylesheets/application.css +1 -0
- data/test/dummy/app/channels/application_cable/channel.rb +4 -0
- data/test/dummy/app/channels/application_cable/connection.rb +4 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/controllers/location_aware_controller.rb +43 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +7 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/application_record.rb +3 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +15 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +33 -0
- data/test/dummy/config/application.rb +22 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +68 -0
- data/test/dummy/config/environments/production.rb +87 -0
- data/test/dummy/config/environments/test.rb +60 -0
- data/test/dummy/config/initializers/content_security_policy.rb +25 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/permissions_policy.rb +11 -0
- data/test/dummy/config/locales/en.yml +33 -0
- data/test/dummy/config/puma.rb +43 -0
- data/test/dummy/config/routes.rb +6 -0
- data/test/dummy/config/storage.yml +34 -0
- data/test/dummy/config.ru +6 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/storage/.keep +0 -0
- data/test/dummy/tmp/.keep +0 -0
- data/test/dummy/tmp/pids/.keep +0 -0
- data/test/dummy/tmp/storage/.keep +0 -0
- data/test/fixtures/companies.yml +9 -9
- data/test/fixtures/custom_locations.yml +61 -61
- data/test/fixtures/locations.yml +61 -61
- data/test/fixtures/mock_addresses.yml +16 -16
- data/test/fixtures/mock_families.yml +2 -2
- data/test/fixtures/mock_houses.yml +8 -8
- data/test/fixtures/mock_organizations.yml +4 -4
- data/test/fixtures/mock_people.yml +4 -4
- data/test/ip_geocode_lookup_test.rb +53 -0
- data/test/models/company.rb +2 -2
- data/test/models/custom_location.rb +11 -11
- data/test/models/location.rb +3 -3
- data/test/models/mock_address.rb +3 -3
- data/test/models/mock_family.rb +4 -4
- data/test/models/mock_house.rb +2 -2
- data/test/models/mock_organization.rb +5 -5
- data/test/models/mock_person.rb +6 -6
- data/test/models/store.rb +2 -2
- data/test/schema.rb +61 -61
- data/test/tasks.rake +37 -37
- data/test/test_helper.rb +83 -56
- metadata +137 -37
- data/.travis.yml +0 -29
- data/test/ip_geocode_lookup_test.disabled.rb +0 -82
data/test/test_helper.rb
CHANGED
|
@@ -1,56 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
require '
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
#
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Start coverage before anything loads the library, or it won't be measured.
|
|
4
|
+
unless ENV['COVERAGE'] == 'off'
|
|
5
|
+
COVERAGE_THRESHOLD = 35
|
|
6
|
+
require 'simplecov'
|
|
7
|
+
require 'simplecov-rcov'
|
|
8
|
+
require 'coveralls'
|
|
9
|
+
Coveralls.wear!
|
|
10
|
+
|
|
11
|
+
SimpleCov.formatters = [
|
|
12
|
+
SimpleCov::Formatter::RcovFormatter,
|
|
13
|
+
Coveralls::SimpleCov::Formatter
|
|
14
|
+
]
|
|
15
|
+
SimpleCov.start do
|
|
16
|
+
add_filter '/test/'
|
|
17
|
+
add_group 'lib', 'lib'
|
|
18
|
+
end
|
|
19
|
+
SimpleCov.at_exit do
|
|
20
|
+
SimpleCov.result.format!
|
|
21
|
+
percent = SimpleCov.result.covered_percent
|
|
22
|
+
unless percent >= COVERAGE_THRESHOLD
|
|
23
|
+
puts "Coverage must be above #{COVERAGE_THRESHOLD}%. It is #{"%.2f" % percent}%"
|
|
24
|
+
Kernel.exit(1)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Configure Rails Environment
|
|
30
|
+
ENV['RAILS_ENV'] = 'test'
|
|
31
|
+
|
|
32
|
+
require_relative '../test/dummy/config/environment'
|
|
33
|
+
ActiveRecord::Migrator.migrations_paths =
|
|
34
|
+
[File.expand_path('../test/dummy/db/migrate', __dir__)]
|
|
35
|
+
require 'rails/test_help'
|
|
36
|
+
|
|
37
|
+
# Load fixtures from the engine
|
|
38
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
|
39
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path('fixtures', __dir__)
|
|
40
|
+
ActionDispatch::IntegrationTest.fixture_path =
|
|
41
|
+
ActiveSupport::TestCase.fixture_path
|
|
42
|
+
ActiveSupport::TestCase.file_fixture_path =
|
|
43
|
+
ActiveSupport::TestCase.fixture_path + '/files'
|
|
44
|
+
ActiveSupport::TestCase.fixtures :all
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
require 'pathname'
|
|
48
|
+
|
|
49
|
+
require 'boot'
|
|
50
|
+
require 'mocha/minitest'
|
|
51
|
+
|
|
52
|
+
require 'geokit'
|
|
53
|
+
require 'geokit-rails'
|
|
54
|
+
|
|
55
|
+
ActiveRecord::Base.send(:include, Geokit::ActsAsMappable::Glue)
|
|
56
|
+
ActionController::Base.send(:include, Geokit::GeocoderControl)
|
|
57
|
+
ActionController::Base.send(:include, Geokit::IpGeocodeLookup)
|
|
58
|
+
# Rails >= 4 requires models classes to be loaded before fixtures are created
|
|
59
|
+
Dir[PLUGIN_ROOT + "test/models/*.rb"].each { |file| require file }
|
|
60
|
+
|
|
61
|
+
class GeokitTestCase < ActiveSupport::TestCase
|
|
62
|
+
begin
|
|
63
|
+
include ActiveRecord::TestFixtures
|
|
64
|
+
rescue NameError
|
|
65
|
+
puts "You appear to be using a pre-2.3 version of Rails. No need to include ActiveRecord::TestFixtures."
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Rails 7.1+ uses fixture_paths instead of fixture_path
|
|
69
|
+
if respond_to?(:fixture_paths=)
|
|
70
|
+
self.fixture_paths = [(PLUGIN_ROOT + 'test/fixtures').to_s]
|
|
71
|
+
else
|
|
72
|
+
self.fixture_path = (PLUGIN_ROOT + 'test/fixtures').to_s
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if Rails::VERSION::MAJOR >= 5
|
|
76
|
+
self.use_transactional_tests = true
|
|
77
|
+
else
|
|
78
|
+
self.use_transactional_fixtures = true
|
|
79
|
+
end
|
|
80
|
+
self.use_instantiated_fixtures = false
|
|
81
|
+
|
|
82
|
+
fixtures :all
|
|
83
|
+
end
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: geokit-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Noack
|
|
8
8
|
- Andre Lewis
|
|
9
9
|
- Bill Eisenhauer
|
|
10
10
|
- Jeremy Lecour
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 2026-10-22 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: rails
|
|
@@ -59,14 +58,14 @@ dependencies:
|
|
|
59
58
|
name: simplecov
|
|
60
59
|
requirement: !ruby/object:Gem::Requirement
|
|
61
60
|
requirements:
|
|
62
|
-
- - "
|
|
61
|
+
- - ">="
|
|
63
62
|
- !ruby/object:Gem::Version
|
|
64
63
|
version: 0.16.1
|
|
65
64
|
type: :development
|
|
66
65
|
prerelease: false
|
|
67
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
68
67
|
requirements:
|
|
69
|
-
- - "
|
|
68
|
+
- - ">="
|
|
70
69
|
- !ruby/object:Gem::Version
|
|
71
70
|
version: 0.16.1
|
|
72
71
|
- !ruby/object:Gem::Dependency
|
|
@@ -84,7 +83,7 @@ dependencies:
|
|
|
84
83
|
- !ruby/object:Gem::Version
|
|
85
84
|
version: '0'
|
|
86
85
|
- !ruby/object:Gem::Dependency
|
|
87
|
-
name:
|
|
86
|
+
name: net-http
|
|
88
87
|
requirement: !ruby/object:Gem::Requirement
|
|
89
88
|
requirements:
|
|
90
89
|
- - ">="
|
|
@@ -98,7 +97,7 @@ dependencies:
|
|
|
98
97
|
- !ruby/object:Gem::Version
|
|
99
98
|
version: '0'
|
|
100
99
|
- !ruby/object:Gem::Dependency
|
|
101
|
-
name:
|
|
100
|
+
name: rake
|
|
102
101
|
requirement: !ruby/object:Gem::Requirement
|
|
103
102
|
requirements:
|
|
104
103
|
- - ">="
|
|
@@ -112,73 +111,73 @@ dependencies:
|
|
|
112
111
|
- !ruby/object:Gem::Version
|
|
113
112
|
version: '0'
|
|
114
113
|
- !ruby/object:Gem::Dependency
|
|
115
|
-
name:
|
|
114
|
+
name: rexml
|
|
116
115
|
requirement: !ruby/object:Gem::Requirement
|
|
117
116
|
requirements:
|
|
118
|
-
- - "
|
|
117
|
+
- - ">="
|
|
119
118
|
- !ruby/object:Gem::Version
|
|
120
|
-
version: '0
|
|
119
|
+
version: '0'
|
|
121
120
|
type: :development
|
|
122
121
|
prerelease: false
|
|
123
122
|
version_requirements: !ruby/object:Gem::Requirement
|
|
124
123
|
requirements:
|
|
125
|
-
- - "
|
|
124
|
+
- - ">="
|
|
126
125
|
- !ruby/object:Gem::Version
|
|
127
|
-
version: '0
|
|
126
|
+
version: '0'
|
|
128
127
|
- !ruby/object:Gem::Dependency
|
|
129
|
-
name:
|
|
128
|
+
name: mocha
|
|
130
129
|
requirement: !ruby/object:Gem::Requirement
|
|
131
130
|
requirements:
|
|
132
|
-
- - "
|
|
131
|
+
- - "~>"
|
|
133
132
|
- !ruby/object:Gem::Version
|
|
134
|
-
version: '0'
|
|
133
|
+
version: '2.0'
|
|
135
134
|
type: :development
|
|
136
135
|
prerelease: false
|
|
137
136
|
version_requirements: !ruby/object:Gem::Requirement
|
|
138
137
|
requirements:
|
|
139
|
-
- - "
|
|
138
|
+
- - "~>"
|
|
140
139
|
- !ruby/object:Gem::Version
|
|
141
|
-
version: '0'
|
|
140
|
+
version: '2.0'
|
|
142
141
|
- !ruby/object:Gem::Dependency
|
|
143
|
-
name:
|
|
142
|
+
name: coveralls_reborn
|
|
144
143
|
requirement: !ruby/object:Gem::Requirement
|
|
145
144
|
requirements:
|
|
146
|
-
- - "
|
|
145
|
+
- - ">="
|
|
147
146
|
- !ruby/object:Gem::Version
|
|
148
|
-
version: '0
|
|
147
|
+
version: '0'
|
|
149
148
|
type: :development
|
|
150
149
|
prerelease: false
|
|
151
150
|
version_requirements: !ruby/object:Gem::Requirement
|
|
152
151
|
requirements:
|
|
153
|
-
- - "
|
|
152
|
+
- - ">="
|
|
154
153
|
- !ruby/object:Gem::Version
|
|
155
|
-
version: '0
|
|
154
|
+
version: '0'
|
|
156
155
|
- !ruby/object:Gem::Dependency
|
|
157
|
-
name:
|
|
156
|
+
name: mysql2
|
|
158
157
|
requirement: !ruby/object:Gem::Requirement
|
|
159
158
|
requirements:
|
|
160
159
|
- - ">="
|
|
161
160
|
- !ruby/object:Gem::Version
|
|
162
|
-
version: '0'
|
|
161
|
+
version: '0.2'
|
|
163
162
|
type: :development
|
|
164
163
|
prerelease: false
|
|
165
164
|
version_requirements: !ruby/object:Gem::Requirement
|
|
166
165
|
requirements:
|
|
167
166
|
- - ">="
|
|
168
167
|
- !ruby/object:Gem::Version
|
|
169
|
-
version: '0'
|
|
168
|
+
version: '0.2'
|
|
170
169
|
- !ruby/object:Gem::Dependency
|
|
171
170
|
name: pg
|
|
172
171
|
requirement: !ruby/object:Gem::Requirement
|
|
173
172
|
requirements:
|
|
174
|
-
- - "
|
|
173
|
+
- - ">="
|
|
175
174
|
- !ruby/object:Gem::Version
|
|
176
175
|
version: '0.10'
|
|
177
176
|
type: :development
|
|
178
177
|
prerelease: false
|
|
179
178
|
version_requirements: !ruby/object:Gem::Requirement
|
|
180
179
|
requirements:
|
|
181
|
-
- - "
|
|
180
|
+
- - ">="
|
|
182
181
|
- !ruby/object:Gem::Version
|
|
183
182
|
version: '0.10'
|
|
184
183
|
- !ruby/object:Gem::Dependency
|
|
@@ -206,22 +205,25 @@ executables: []
|
|
|
206
205
|
extensions: []
|
|
207
206
|
extra_rdoc_files: []
|
|
208
207
|
files:
|
|
208
|
+
- ".github/workflows/ci.yml"
|
|
209
209
|
- ".gitignore"
|
|
210
|
-
- ".travis.yml"
|
|
211
210
|
- CHANGELOG.md
|
|
212
211
|
- CONFIG.markdown
|
|
213
212
|
- Gemfile
|
|
214
213
|
- MIT-LICENSE
|
|
215
214
|
- README.markdown
|
|
216
215
|
- Rakefile
|
|
217
|
-
- gemfiles/
|
|
218
|
-
- gemfiles/
|
|
219
|
-
- gemfiles/
|
|
216
|
+
- gemfiles/rails7.1.gemfile
|
|
217
|
+
- gemfiles/rails7.2.gemfile
|
|
218
|
+
- gemfiles/rails8.0.gemfile
|
|
219
|
+
- gemfiles/rails8.1.gemfile
|
|
220
220
|
- geokit-rails.gemspec
|
|
221
221
|
- lib/generators/geokit_rails/install_generator.rb
|
|
222
222
|
- lib/generators/templates/geokit_config.rb
|
|
223
223
|
- lib/geokit-rails.rb
|
|
224
224
|
- lib/geokit-rails/acts_as_mappable.rb
|
|
225
|
+
- lib/geokit-rails/acts_as_mappable/class_methods.rb
|
|
226
|
+
- lib/geokit-rails/acts_as_mappable/glue.rb
|
|
225
227
|
- lib/geokit-rails/adapters/abstract.rb
|
|
226
228
|
- lib/geokit-rails/adapters/mysql.rb
|
|
227
229
|
- lib/geokit-rails/adapters/mysql2.rb
|
|
@@ -230,14 +232,64 @@ files:
|
|
|
230
232
|
- lib/geokit-rails/adapters/postgresql.rb
|
|
231
233
|
- lib/geokit-rails/adapters/sqlite.rb
|
|
232
234
|
- lib/geokit-rails/adapters/sqlserver.rb
|
|
233
|
-
- lib/geokit-rails/
|
|
235
|
+
- lib/geokit-rails/distance_collection.rb
|
|
234
236
|
- lib/geokit-rails/geocoder_control.rb
|
|
235
237
|
- lib/geokit-rails/ip_geocode_lookup.rb
|
|
236
238
|
- lib/geokit-rails/railtie.rb
|
|
237
239
|
- lib/geokit-rails/version.rb
|
|
238
240
|
- test/acts_as_mappable_test.rb
|
|
241
|
+
- test/adapter_resolution_test.rb
|
|
239
242
|
- test/boot.rb
|
|
240
243
|
- test/database.yml
|
|
244
|
+
- test/distance_collection_test.rb
|
|
245
|
+
- test/dummy/Rakefile
|
|
246
|
+
- test/dummy/app/assets/images/.keep
|
|
247
|
+
- test/dummy/app/assets/stylesheets/application.css
|
|
248
|
+
- test/dummy/app/channels/application_cable/channel.rb
|
|
249
|
+
- test/dummy/app/channels/application_cable/connection.rb
|
|
250
|
+
- test/dummy/app/controllers/application_controller.rb
|
|
251
|
+
- test/dummy/app/controllers/concerns/.keep
|
|
252
|
+
- test/dummy/app/controllers/location_aware_controller.rb
|
|
253
|
+
- test/dummy/app/helpers/application_helper.rb
|
|
254
|
+
- test/dummy/app/jobs/application_job.rb
|
|
255
|
+
- test/dummy/app/mailers/application_mailer.rb
|
|
256
|
+
- test/dummy/app/models/application_record.rb
|
|
257
|
+
- test/dummy/app/models/concerns/.keep
|
|
258
|
+
- test/dummy/app/views/layouts/application.html.erb
|
|
259
|
+
- test/dummy/app/views/layouts/mailer.html.erb
|
|
260
|
+
- test/dummy/app/views/layouts/mailer.text.erb
|
|
261
|
+
- test/dummy/bin/rails
|
|
262
|
+
- test/dummy/bin/rake
|
|
263
|
+
- test/dummy/bin/setup
|
|
264
|
+
- test/dummy/config.ru
|
|
265
|
+
- test/dummy/config/application.rb
|
|
266
|
+
- test/dummy/config/boot.rb
|
|
267
|
+
- test/dummy/config/cable.yml
|
|
268
|
+
- test/dummy/config/database.yml
|
|
269
|
+
- test/dummy/config/environment.rb
|
|
270
|
+
- test/dummy/config/environments/development.rb
|
|
271
|
+
- test/dummy/config/environments/production.rb
|
|
272
|
+
- test/dummy/config/environments/test.rb
|
|
273
|
+
- test/dummy/config/initializers/content_security_policy.rb
|
|
274
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
|
275
|
+
- test/dummy/config/initializers/inflections.rb
|
|
276
|
+
- test/dummy/config/initializers/permissions_policy.rb
|
|
277
|
+
- test/dummy/config/locales/en.yml
|
|
278
|
+
- test/dummy/config/puma.rb
|
|
279
|
+
- test/dummy/config/routes.rb
|
|
280
|
+
- test/dummy/config/storage.yml
|
|
281
|
+
- test/dummy/lib/assets/.keep
|
|
282
|
+
- test/dummy/log/.keep
|
|
283
|
+
- test/dummy/public/404.html
|
|
284
|
+
- test/dummy/public/422.html
|
|
285
|
+
- test/dummy/public/500.html
|
|
286
|
+
- test/dummy/public/apple-touch-icon-precomposed.png
|
|
287
|
+
- test/dummy/public/apple-touch-icon.png
|
|
288
|
+
- test/dummy/public/favicon.ico
|
|
289
|
+
- test/dummy/storage/.keep
|
|
290
|
+
- test/dummy/tmp/.keep
|
|
291
|
+
- test/dummy/tmp/pids/.keep
|
|
292
|
+
- test/dummy/tmp/storage/.keep
|
|
241
293
|
- test/fixtures/companies.yml
|
|
242
294
|
- test/fixtures/custom_locations.yml
|
|
243
295
|
- test/fixtures/locations.yml
|
|
@@ -247,7 +299,7 @@ files:
|
|
|
247
299
|
- test/fixtures/mock_organizations.yml
|
|
248
300
|
- test/fixtures/mock_people.yml
|
|
249
301
|
- test/fixtures/stores.yml
|
|
250
|
-
- test/ip_geocode_lookup_test.
|
|
302
|
+
- test/ip_geocode_lookup_test.rb
|
|
251
303
|
- test/models/company.rb
|
|
252
304
|
- test/models/custom_location.rb
|
|
253
305
|
- test/models/location.rb
|
|
@@ -264,7 +316,6 @@ homepage: http://github.com/geokit/geokit-rails
|
|
|
264
316
|
licenses:
|
|
265
317
|
- MIT
|
|
266
318
|
metadata: {}
|
|
267
|
-
post_install_message:
|
|
268
319
|
rdoc_options: []
|
|
269
320
|
require_paths:
|
|
270
321
|
- lib
|
|
@@ -279,14 +330,63 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
279
330
|
- !ruby/object:Gem::Version
|
|
280
331
|
version: '0'
|
|
281
332
|
requirements: []
|
|
282
|
-
rubygems_version: 3.
|
|
283
|
-
signing_key:
|
|
333
|
+
rubygems_version: 3.6.4
|
|
284
334
|
specification_version: 4
|
|
285
335
|
summary: Geokit helpers for rails apps.
|
|
286
336
|
test_files:
|
|
287
337
|
- test/acts_as_mappable_test.rb
|
|
338
|
+
- test/adapter_resolution_test.rb
|
|
288
339
|
- test/boot.rb
|
|
289
340
|
- test/database.yml
|
|
341
|
+
- test/distance_collection_test.rb
|
|
342
|
+
- test/dummy/Rakefile
|
|
343
|
+
- test/dummy/app/assets/images/.keep
|
|
344
|
+
- test/dummy/app/assets/stylesheets/application.css
|
|
345
|
+
- test/dummy/app/channels/application_cable/channel.rb
|
|
346
|
+
- test/dummy/app/channels/application_cable/connection.rb
|
|
347
|
+
- test/dummy/app/controllers/application_controller.rb
|
|
348
|
+
- test/dummy/app/controllers/concerns/.keep
|
|
349
|
+
- test/dummy/app/controllers/location_aware_controller.rb
|
|
350
|
+
- test/dummy/app/helpers/application_helper.rb
|
|
351
|
+
- test/dummy/app/jobs/application_job.rb
|
|
352
|
+
- test/dummy/app/mailers/application_mailer.rb
|
|
353
|
+
- test/dummy/app/models/application_record.rb
|
|
354
|
+
- test/dummy/app/models/concerns/.keep
|
|
355
|
+
- test/dummy/app/views/layouts/application.html.erb
|
|
356
|
+
- test/dummy/app/views/layouts/mailer.html.erb
|
|
357
|
+
- test/dummy/app/views/layouts/mailer.text.erb
|
|
358
|
+
- test/dummy/bin/rails
|
|
359
|
+
- test/dummy/bin/rake
|
|
360
|
+
- test/dummy/bin/setup
|
|
361
|
+
- test/dummy/config.ru
|
|
362
|
+
- test/dummy/config/application.rb
|
|
363
|
+
- test/dummy/config/boot.rb
|
|
364
|
+
- test/dummy/config/cable.yml
|
|
365
|
+
- test/dummy/config/database.yml
|
|
366
|
+
- test/dummy/config/environment.rb
|
|
367
|
+
- test/dummy/config/environments/development.rb
|
|
368
|
+
- test/dummy/config/environments/production.rb
|
|
369
|
+
- test/dummy/config/environments/test.rb
|
|
370
|
+
- test/dummy/config/initializers/content_security_policy.rb
|
|
371
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
|
372
|
+
- test/dummy/config/initializers/inflections.rb
|
|
373
|
+
- test/dummy/config/initializers/permissions_policy.rb
|
|
374
|
+
- test/dummy/config/locales/en.yml
|
|
375
|
+
- test/dummy/config/puma.rb
|
|
376
|
+
- test/dummy/config/routes.rb
|
|
377
|
+
- test/dummy/config/storage.yml
|
|
378
|
+
- test/dummy/lib/assets/.keep
|
|
379
|
+
- test/dummy/log/.keep
|
|
380
|
+
- test/dummy/public/404.html
|
|
381
|
+
- test/dummy/public/422.html
|
|
382
|
+
- test/dummy/public/500.html
|
|
383
|
+
- test/dummy/public/apple-touch-icon-precomposed.png
|
|
384
|
+
- test/dummy/public/apple-touch-icon.png
|
|
385
|
+
- test/dummy/public/favicon.ico
|
|
386
|
+
- test/dummy/storage/.keep
|
|
387
|
+
- test/dummy/tmp/.keep
|
|
388
|
+
- test/dummy/tmp/pids/.keep
|
|
389
|
+
- test/dummy/tmp/storage/.keep
|
|
290
390
|
- test/fixtures/companies.yml
|
|
291
391
|
- test/fixtures/custom_locations.yml
|
|
292
392
|
- test/fixtures/locations.yml
|
|
@@ -296,7 +396,7 @@ test_files:
|
|
|
296
396
|
- test/fixtures/mock_organizations.yml
|
|
297
397
|
- test/fixtures/mock_people.yml
|
|
298
398
|
- test/fixtures/stores.yml
|
|
299
|
-
- test/ip_geocode_lookup_test.
|
|
399
|
+
- test/ip_geocode_lookup_test.rb
|
|
300
400
|
- test/models/company.rb
|
|
301
401
|
- test/models/custom_location.rb
|
|
302
402
|
- test/models/location.rb
|
data/.travis.yml
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
rvm:
|
|
3
|
-
- 2.0
|
|
4
|
-
- 2.1
|
|
5
|
-
- 2.2
|
|
6
|
-
- 2.3
|
|
7
|
-
- 2.4
|
|
8
|
-
gemfile:
|
|
9
|
-
- gemfiles/rails3.gemfile
|
|
10
|
-
- gemfiles/rails4.gemfile
|
|
11
|
-
- gemfiles/rails5.gemfile
|
|
12
|
-
matrix:
|
|
13
|
-
exclude:
|
|
14
|
-
- rvm: 2.2
|
|
15
|
-
gemfile: gemfiles/rails3.gemfile
|
|
16
|
-
- rvm: 2.3
|
|
17
|
-
gemfile: gemfiles/rails3.gemfile
|
|
18
|
-
- rvm: 2.4
|
|
19
|
-
gemfile: gemfiles/rails3.gemfile
|
|
20
|
-
- rvm: 2.0
|
|
21
|
-
gemfile: gemfiles/rails5.gemfile
|
|
22
|
-
- rvm: 2.1
|
|
23
|
-
gemfile: gemfiles/rails5.gemfile
|
|
24
|
-
script: "bundle exec rake coverage"
|
|
25
|
-
before_install:
|
|
26
|
-
- gem install bundler
|
|
27
|
-
bundler_args: --retry 5
|
|
28
|
-
sudo: false
|
|
29
|
-
cache: bundler
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
require 'test_helper'
|
|
2
|
-
|
|
3
|
-
module TestApp
|
|
4
|
-
class Application < Rails::Application
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
TestApp::Application.routes.draw do
|
|
9
|
-
match ':controller(/:action(/:id(.:format)))'
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
class LocationAwareController < ActionController::Base #:nodoc: all
|
|
13
|
-
geocode_ip_address
|
|
14
|
-
|
|
15
|
-
def index
|
|
16
|
-
render :nothing => true
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def rescue_action(e) raise e end;
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
class ActionController::TestRequest #:nodoc: all
|
|
23
|
-
attr_accessor :remote_ip
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
class IpGeocodeLookupTest < ActionController::TestCase
|
|
27
|
-
tests LocationAwareController
|
|
28
|
-
|
|
29
|
-
def setup
|
|
30
|
-
@success = Geokit::GeoLoc.new
|
|
31
|
-
@success.provider = "hostip"
|
|
32
|
-
@success.lat = 41.7696
|
|
33
|
-
@success.lng = -88.4588
|
|
34
|
-
@success.city = "Sugar Grove"
|
|
35
|
-
@success.state = "IL"
|
|
36
|
-
@success.country_code = "US"
|
|
37
|
-
@success.success = true
|
|
38
|
-
|
|
39
|
-
@failure = Geokit::GeoLoc.new
|
|
40
|
-
@failure.provider = "hostip"
|
|
41
|
-
@failure.city = "(Private Address)"
|
|
42
|
-
@failure.success = false
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_no_location_in_cookie_or_session
|
|
46
|
-
Geokit::Geocoders::MultiGeocoder.expects(:geocode).with("good ip").returns(@success)
|
|
47
|
-
@request.remote_ip = "good ip"
|
|
48
|
-
get :index
|
|
49
|
-
verify
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def test_location_in_cookie
|
|
53
|
-
@request.remote_ip = "good ip"
|
|
54
|
-
@request.cookies['geo_location'] = @success.to_yaml
|
|
55
|
-
get :index
|
|
56
|
-
verify
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def test_location_in_session
|
|
60
|
-
@request.remote_ip = "good ip"
|
|
61
|
-
@request.session[:geo_location] = @success
|
|
62
|
-
@request.cookies['geo_location'] = CGI::Cookie.new('geo_location', @success.to_yaml)
|
|
63
|
-
get :index
|
|
64
|
-
verify
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def test_ip_not_located
|
|
68
|
-
Geokit::Geocoders::MultiGeocoder.expects(:geocode).with("bad ip").returns(@failure)
|
|
69
|
-
@request.remote_ip = "bad ip"
|
|
70
|
-
get :index
|
|
71
|
-
assert_nil @request.session[:geo_location]
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
private
|
|
75
|
-
|
|
76
|
-
def verify
|
|
77
|
-
assert_response :success
|
|
78
|
-
assert_equal @success, @request.session[:geo_location]
|
|
79
|
-
assert_not_nil cookies['geo_location']
|
|
80
|
-
assert_equal @success, YAML.load(cookies['geo_location'])
|
|
81
|
-
end
|
|
82
|
-
end
|