ip_to_country 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/ip_to_country/request.rb +1 -1
- data/lib/ip_to_country/version.rb +1 -1
- data/test/dummy/log/test.log +0 -4319
- data/test/request_test.rb +5 -5
- data/test/test_helper.rb +4 -3
- metadata +49 -49
data/test/request_test.rb
CHANGED
@@ -6,23 +6,23 @@ require 'test_helper'
|
|
6
6
|
class RequestTest < Test::Unit::TestCase
|
7
7
|
class MockRequest
|
8
8
|
include IpToCountry::Request
|
9
|
-
attr_accessor :env, :
|
9
|
+
attr_accessor :env, :remote_ip
|
10
10
|
def initialize(env={}, ip="")
|
11
11
|
@env = env
|
12
|
-
@
|
12
|
+
@remote_ip = ip
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def test_http_x_real_ip
|
17
17
|
req = MockRequest.new({"HTTP_X_REAL_IP" => "192.168.1.2"})
|
18
18
|
assert req.geoip.is_a?(IpToCountry::Geoip)
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def test_http_x_forwarded_for_without_proxy
|
22
22
|
req = MockRequest.new({"HTTP_X_FORWARDED_FOR" => "192.168.1.2"})
|
23
23
|
assert req.geoip.is_a?(IpToCountry::Geoip)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def test_http_x_forwarded_for_with_proxy
|
27
27
|
req = MockRequest.new({"HTTP_X_FORWARDED_FOR" => "192.168.1.2, 192.168.1.7"})
|
28
28
|
assert req.geoip.is_a?(IpToCountry::Geoip)
|
data/test/test_helper.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
require 'coveralls'
|
4
|
+
Coveralls.wear!
|
5
|
+
|
2
6
|
# Configure Rails Environment
|
3
7
|
ENV["RAILS_ENV"] = "test"
|
4
8
|
|
5
9
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
6
10
|
require "rails/test_help"
|
7
11
|
require "simplecov"
|
8
|
-
require 'coveralls'
|
9
12
|
require "mocha/setup"
|
10
13
|
|
11
|
-
Coveralls.wear!
|
12
|
-
|
13
14
|
Rails.backtrace_cleaner.remove_silencers!
|
14
15
|
|
15
16
|
# Run any available migration
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ip_to_country
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Pochet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -39,55 +39,55 @@ extensions: []
|
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
41
|
- app/models/ip_to_country/geoip.rb
|
42
|
-
- lib/ip_to_country/engine.rb
|
43
|
-
- lib/ip_to_country/loader.rb
|
44
42
|
- lib/ip_to_country/version.rb
|
43
|
+
- lib/ip_to_country/loader.rb
|
44
|
+
- lib/ip_to_country/engine.rb
|
45
45
|
- lib/ip_to_country/request.rb
|
46
|
-
- lib/ip_to_country.
|
46
|
+
- lib/tasks/ip_to_country.rake
|
47
47
|
- lib/generators/geoip/geoip_generator.rb
|
48
48
|
- lib/generators/geoip/templates/migration.rb
|
49
|
-
- lib/
|
49
|
+
- lib/ip_to_country.rb
|
50
50
|
- MIT-LICENSE
|
51
51
|
- Rakefile
|
52
52
|
- README.md
|
53
|
-
- test/ip_to_country_test.rb
|
54
53
|
- test/loader_test.rb
|
55
|
-
- test/
|
56
|
-
- test/
|
54
|
+
- test/request_test.rb
|
55
|
+
- test/ip_to_country_test.rb
|
57
56
|
- test/fixtures/geoips.yml
|
58
57
|
- test/fixtures/ips/test_ips.csv
|
59
58
|
- test/fixtures/ips/test_ips.zip
|
60
|
-
- test/
|
61
|
-
- test/dummy/
|
62
|
-
- test/dummy/
|
63
|
-
- test/dummy/
|
59
|
+
- test/geoip_test.rb
|
60
|
+
- test/dummy/app/views/layouts/application.html.erb
|
61
|
+
- test/dummy/app/controllers/application_controller.rb
|
62
|
+
- test/dummy/app/helpers/application_helper.rb
|
63
|
+
- test/dummy/app/assets/javascripts/application.js
|
64
|
+
- test/dummy/app/assets/stylesheets/application.css
|
65
|
+
- test/dummy/README.rdoc
|
66
|
+
- test/dummy/config.ru
|
64
67
|
- test/dummy/public/500.html
|
65
|
-
- test/dummy/public/422.html
|
66
68
|
- test/dummy/public/404.html
|
67
|
-
- test/dummy/
|
68
|
-
- test/dummy/
|
69
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
69
|
+
- test/dummy/public/422.html
|
70
|
+
- test/dummy/public/favicon.ico
|
70
71
|
- test/dummy/config/initializers/mime_types.rb
|
71
72
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
72
|
-
- test/dummy/config/initializers/inflections.rb
|
73
73
|
- test/dummy/config/initializers/session_store.rb
|
74
|
+
- test/dummy/config/initializers/inflections.rb
|
74
75
|
- test/dummy/config/initializers/secret_token.rb
|
75
|
-
- test/dummy/config/
|
76
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
77
|
+
- test/dummy/config/application.rb
|
76
78
|
- test/dummy/config/boot.rb
|
79
|
+
- test/dummy/config/locales/en.yml
|
80
|
+
- test/dummy/config/database.yml
|
77
81
|
- test/dummy/config/routes.rb
|
78
82
|
- test/dummy/config/environment.rb
|
79
83
|
- test/dummy/config/environments/development.rb
|
80
84
|
- test/dummy/config/environments/test.rb
|
81
85
|
- test/dummy/config/environments/production.rb
|
82
|
-
- test/dummy/README.rdoc
|
83
|
-
- test/dummy/app/helpers/application_helper.rb
|
84
|
-
- test/dummy/app/controllers/application_controller.rb
|
85
|
-
- test/dummy/app/assets/stylesheets/application.css
|
86
|
-
- test/dummy/app/assets/javascripts/application.js
|
87
|
-
- test/dummy/app/views/layouts/application.html.erb
|
88
|
-
- test/dummy/config.ru
|
89
|
-
- test/dummy/Rakefile
|
90
86
|
- test/dummy/db/migrate/001_create_geoips.rb
|
87
|
+
- test/dummy/Rakefile
|
88
|
+
- test/dummy/script/rails
|
89
|
+
- test/dummy/log/test.log
|
90
|
+
- test/test_helper.rb
|
91
91
|
homepage: https://github.com/vincent-pochet/ip_to_country
|
92
92
|
licenses: []
|
93
93
|
metadata: {}
|
@@ -107,46 +107,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.1.11
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Rails extension to get country name or country code from an IP address.
|
114
114
|
test_files:
|
115
|
-
- test/ip_to_country_test.rb
|
116
115
|
- test/loader_test.rb
|
117
|
-
- test/
|
118
|
-
- test/
|
116
|
+
- test/request_test.rb
|
117
|
+
- test/ip_to_country_test.rb
|
119
118
|
- test/fixtures/geoips.yml
|
120
119
|
- test/fixtures/ips/test_ips.csv
|
121
120
|
- test/fixtures/ips/test_ips.zip
|
122
|
-
- test/
|
123
|
-
- test/dummy/
|
124
|
-
- test/dummy/
|
125
|
-
- test/dummy/
|
121
|
+
- test/geoip_test.rb
|
122
|
+
- test/dummy/app/views/layouts/application.html.erb
|
123
|
+
- test/dummy/app/controllers/application_controller.rb
|
124
|
+
- test/dummy/app/helpers/application_helper.rb
|
125
|
+
- test/dummy/app/assets/javascripts/application.js
|
126
|
+
- test/dummy/app/assets/stylesheets/application.css
|
127
|
+
- test/dummy/README.rdoc
|
128
|
+
- test/dummy/config.ru
|
126
129
|
- test/dummy/public/500.html
|
127
|
-
- test/dummy/public/422.html
|
128
130
|
- test/dummy/public/404.html
|
129
|
-
- test/dummy/
|
130
|
-
- test/dummy/
|
131
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
131
|
+
- test/dummy/public/422.html
|
132
|
+
- test/dummy/public/favicon.ico
|
132
133
|
- test/dummy/config/initializers/mime_types.rb
|
133
134
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
134
|
-
- test/dummy/config/initializers/inflections.rb
|
135
135
|
- test/dummy/config/initializers/session_store.rb
|
136
|
+
- test/dummy/config/initializers/inflections.rb
|
136
137
|
- test/dummy/config/initializers/secret_token.rb
|
137
|
-
- test/dummy/config/
|
138
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
139
|
+
- test/dummy/config/application.rb
|
138
140
|
- test/dummy/config/boot.rb
|
141
|
+
- test/dummy/config/locales/en.yml
|
142
|
+
- test/dummy/config/database.yml
|
139
143
|
- test/dummy/config/routes.rb
|
140
144
|
- test/dummy/config/environment.rb
|
141
145
|
- test/dummy/config/environments/development.rb
|
142
146
|
- test/dummy/config/environments/test.rb
|
143
147
|
- test/dummy/config/environments/production.rb
|
144
|
-
- test/dummy/README.rdoc
|
145
|
-
- test/dummy/app/helpers/application_helper.rb
|
146
|
-
- test/dummy/app/controllers/application_controller.rb
|
147
|
-
- test/dummy/app/assets/stylesheets/application.css
|
148
|
-
- test/dummy/app/assets/javascripts/application.js
|
149
|
-
- test/dummy/app/views/layouts/application.html.erb
|
150
|
-
- test/dummy/config.ru
|
151
|
-
- test/dummy/Rakefile
|
152
148
|
- test/dummy/db/migrate/001_create_geoips.rb
|
149
|
+
- test/dummy/Rakefile
|
150
|
+
- test/dummy/script/rails
|
151
|
+
- test/dummy/log/test.log
|
152
|
+
- test/test_helper.rb
|