rack-ketai 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,49 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'rack/ketai/position'
3
-
4
- describe "Rack::Ketai::Position" do
5
-
6
- describe "生成する際" do
7
- it "lat,lngをFloatで与えることができること" do
8
- position = Rack::Ketai::Position.new(:lat => 35.009888888889,
9
- :lng => 135.69322222222)
10
- format("%.10f", position.lat).should == "35.0098888889"
11
- format("%.10f", position.lng).should == "135.6932222222"
12
- end
13
-
14
- it "lat,lngを度分秒の配列で与えることができること" do
15
- position = Rack::Ketai::Position.new(:lat => [35, 0 ,35.6],
16
- :lng => [135, 41, 35.6])
17
- format("%.10f", position.lat).should == "35.0098888889"
18
- format("%.10f", position.lng).should == "135.6932222222"
19
- end
20
-
21
- it "lat,lngを度分秒の文字列" do
22
- position = Rack::Ketai::Position.new(:lat => "35.00.35.600",
23
- :lng => "135.41.35.600")
24
- format("%.10f", position.lat).should == "35.0098888889"
25
- format("%.10f", position.lng).should == "135.6932222222"
26
- end
27
- end
28
-
29
- describe "パラメータを取得する際" do
30
- before(:each) do
31
- @position = Rack::Ketai::Position.new(:lat => 35.009888888889,
32
- :lng => 135.69322222222)
33
- end
34
-
35
- it "#lat, #lng 引数無しの時はwgs84" do
36
- format("%.10f", @position.lat).should == "35.0098888889"
37
- format("%.10f", @position.lng).should == "135.6932222222"
38
- end
39
-
40
- it "#lat, #lng 引数で測地系を指定" do
41
- format("%.10f", @position.lat(:wgs84)).should == "35.0098888889"
42
- format("%.10f", @position.lng(:wgs84)).should == "135.6932222222"
43
-
44
- format("%.10f", @position.lat(:tokyo97)).should == "35.0066762382"
45
- format("%.10f", @position.lng(:tokyo97)).should == "135.6960795432"
46
- end
47
- end
48
-
49
- end
@@ -1,142 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'kconv'
3
- require 'rack/ketai/carrier/softbank'
4
- describe Rack::Ketai::Carrier::Softbank::Filter, "内部フィルタを適用する時" do
5
-
6
- before(:each) do
7
- @filter = Rack::Ketai::Carrier::Softbank::Filter.new
8
- end
9
-
10
- # Rails 3.0.0+Ruby1.9.xのとき、bodyにeachの使えないStringが渡されてエラーになったので
11
- it "bodyにStringを受け取ってもよきにはからってくれること" do
12
- status, headers, body = @filter.outbound(200, { "Content-Type" => "text/html"}, 'String')
13
- body.should == ['String']
14
- end
15
-
16
- it "POSTデータ中のUTF-8バイナリの絵文字を絵文字IDに変換すること" do
17
- Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID.should_not be_empty
18
- Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID.each do |emoji, emojiid|
19
- postdata = "message=" + CGI.escape("今日はいい" + emoji + "ですね。")
20
- postdata.force_encoding('UTF-8') if postdata.respond_to?(:force_encoding)
21
-
22
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
23
- 'HTTP_USER_AGENT' => 'Softbank/2.0 P903i',
24
- :method => 'POST',
25
- :input => postdata)
26
- env = @filter.inbound(env)
27
- request = Rack::Request.new(env)
28
- request.params['message'].should == '今日はいい[e:'+format("%03X", emojiid)+']ですね。'
29
- end
30
- end
31
-
32
- it "POSTデータ中のウェブコードの絵文字を絵文字IDに変換すること" do
33
- Rack::Ketai::Carrier::Softbank::Filter::WEBCODE_TO_EMOJI.should_not be_empty
34
- Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID.should_not be_empty
35
- Rack::Ketai::Carrier::Softbank::Filter::WEBCODE_TO_EMOJI.each do |webcode, emoji|
36
- emojiid = Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID[emoji]
37
- postdata = "message=" + CGI.escape("今日はいい\x1B$" + webcode + "\x0Fですね。")
38
- postdata.force_encoding('UTF-8') if postdata.respond_to?(:force_encoding)
39
-
40
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
41
- 'HTTP_USER_AGENT' => 'Softbank/2.0 P903i',
42
- :method => 'POST',
43
- :input => postdata)
44
- env = @filter.inbound(env)
45
- request = Rack::Request.new(env)
46
- request.params['message'].should == '今日はいい[e:'+format("%03X", emojiid)+']ですね。'
47
- end
48
- end
49
-
50
- it "POSTデータ中の連続するウェブコードの絵文字を絵文字IDに変換すること" do
51
- postdata = "message=" + CGI.escape("今日の天気は\x1B$Gji\x0Fです\x1B$ON\x0F")
52
- postdata.force_encoding('UTF-8') if postdata.respond_to?(:force_encoding)
53
-
54
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
55
- 'HTTP_USER_AGENT' => 'Softbank/2.0 P903i',
56
- :method => 'POST',
57
- :input => postdata)
58
- env = @filter.inbound(env)
59
- request = Rack::Request.new(env)
60
- request.params['message'].should == '今日の天気は[e:00F]です[e:B60]'
61
- end
62
-
63
- end
64
-
65
- describe Rack::Ketai::Carrier::Softbank::Filter, "外部フィルタを適用する時" do
66
-
67
- before(:each) do
68
- @filter = Rack::Ketai::Carrier::Softbank::Filter.new
69
- end
70
-
71
- it "データ中の絵文字IDをウェブコードに変換すること" do
72
- Rack::Ketai::Carrier::Softbank::Filter::WEBCODE_TO_EMOJI.should_not be_empty
73
- Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID.should_not be_empty
74
- Rack::Ketai::Carrier::Softbank::Filter::WEBCODE_TO_EMOJI.each do |webcode, emoji|
75
- emojiid = Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID[emoji]
76
- resdata = "今日はいい\x1B$#{webcode}\x0Fですね。"
77
-
78
- status, headers, body = @filter.outbound(200, { "Content-Type" => "text/html"}, ['今日はいい[e:'+format("%03X", emojiid)+']ですね。'])
79
-
80
- body[0].should == resdata
81
- end
82
-
83
- resdata = "今日の天気は\x1B$Gj\x0F\x1B$Gi\x0Fです\x1B$ON\x0F"
84
- status, headers, body = @filter.outbound(200, { "Content-Type" => "text/html"}, ['今日の天気は[e:00F]です[e:B60]'])
85
- body[0].should == resdata
86
- end
87
-
88
- it "Content-typeが指定なし,text/html, application/xhtml+xml 以外の時はフィルタを適用しないこと" do
89
- Rack::Ketai::Carrier::Softbank::Filter::WEBCODE_TO_EMOJI.should_not be_empty
90
- Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID.should_not be_empty
91
- Rack::Ketai::Carrier::Softbank::Filter::WEBCODE_TO_EMOJI.each do |webcode, emoji|
92
- emojiid = Rack::Ketai::Carrier::Softbank::Filter::EMOJI_TO_EMOJIID[emoji]
93
- internaldata = '今日はいい[e:'+format("%03X", emojiid)+']ですね。'
94
- %w(text/plain text/xml text/json application/json text/javascript application/rss+xml image/jpeg).each do |contenttype|
95
- status, headers, body = @filter.outbound(200, { "Content-Type" => contenttype }, [internaldata])
96
- body[0].should == internaldata
97
- end
98
- end
99
- end
100
-
101
- it "データ中に絵文字ID=絵文字IDだが絵文字≠絵文字IDのIDが含まれているとき、正しく逆変換できること" do
102
- emoji = [0xF649].pack('n')
103
- resdata = "たとえば\x1B$P*\x0F「e-33E RELIEVED FACE」とか。"
104
-
105
- status, headers, body = @filter.outbound(200, { "Content-Type" => "text/html"}, ["たとえば[e:33E]「e-33E RELIEVED FACE」とか。"])
106
-
107
- body[0].should == resdata
108
- end
109
-
110
- it "データ中にSoftBankにはない絵文字IDが存在するとき、代替文字を表示すること" do
111
- resdata = "Soon[SOON]です" # soon
112
-
113
- status, headers, body = @filter.outbound(200, { "Content-Type" => "text/html"}, ['Soon[e:018]です'])
114
-
115
- body[0].should == resdata
116
- end
117
-
118
- it "Content-typeを適切に書き換えられること" do
119
- [
120
- [nil, nil],
121
- ['text/html', 'text/html; charset=utf-8'],
122
- ['text/html; charset=utf-8', 'text/html; charset=utf-8'],
123
- ['text/html;charset=utf-8', 'text/html;charset=utf-8'],
124
- ['application/xhtml+xml', 'application/xhtml+xml; charset=utf-8'],
125
- ['application/xhtml+xml; charset=utf-8', 'application/xhtml+xml; charset=utf-8'],
126
- ['application/xhtml+xml;charset=utf-8', 'application/xhtml+xml;charset=utf-8'],
127
- ['text/javascript', 'text/javascript'],
128
- ['text/json', 'text/json'],
129
- ['application/json', 'application/json'],
130
- ['text/javascript+json', 'text/javascript+json'],
131
- ['image/jpeg', 'image/jpeg'],
132
- ['application/octet-stream', 'application/octet-stream'],
133
- ].each do |content_type, valid_content_type|
134
- orig_content_type = content_type == nil ? nil : content_type.clone
135
- status, headers, body = @filter.outbound(200, { "Content-Type" => content_type}, ['適当な本文'])
136
- headers['Content-Type'].should == valid_content_type
137
- # 元の文字列に直接変更を加えない(Rails3.0でハッシュを使い回してるようだったので)
138
- content_type.should == orig_content_type
139
- end
140
- end
141
-
142
- end
@@ -1,207 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'rack/ketai/carrier/softbank'
3
- describe "Rack::Ketai::Carrier::Softbank" do
4
-
5
- before(:each) do
6
-
7
- end
8
-
9
- # http://creation.mb.softbank.jp/web/web_ua_about.html
10
- # SoftBank 3G Series => 3GC型
11
- # C型 P型は省略(もうなくなるし)
12
-
13
- describe "3GCケータイで" do
14
-
15
- # http://ke-tai.org/blog/2008/09/08/phoneid/
16
- # http://creation.mb.softbank.jp/web/web_ua_about.html
17
-
18
- describe "端末シリアル番号とX-JPHONE-UIDが送信されたとき" do
19
-
20
- before(:each) do
21
- @env = Rack::MockRequest.env_for('http://hoge.com/dummy',
22
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/824T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
23
- 'HTTP_X_JPHONE_UID' => 'c10Sty5bmqjsZeb2')
24
- @mobile = Rack::Ketai::Carrier::Softbank.new(@env)
25
- end
26
-
27
- it "#subscriberid でx-jphone-uidを取得できること" do
28
- @mobile.subscriberid.should == 'c10Sty5bmqjsZeb2'
29
- end
30
-
31
- it "#deviceid で端末シリアル番号を取得できること" do
32
- @mobile.deviceid.should == '000000000000000'
33
- end
34
-
35
- it "#ident でx-jphone-uidを取得できること" do
36
- @mobile.ident.should == @mobile.subscriberid
37
- @mobile.ident.should == 'c10Sty5bmqjsZeb2'
38
- end
39
- end
40
-
41
- describe "端末シリアル番号の送出が禁止されているとき(最近のはデフォルトでこう)" do
42
-
43
- before(:each) do
44
- @env = Rack::MockRequest.env_for('http://hoge.com/dummy',
45
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/824T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1',
46
- 'HTTP_X_JPHONE_UID' => 'c10Sty5bmqjsZeb2')
47
- @mobile = Rack::Ketai::Carrier::Softbank.new(@env)
48
- end
49
-
50
- it "#subscriberid でx-jphone-uidを取得できること" do
51
- @mobile.subscriberid.should == 'c10Sty5bmqjsZeb2'
52
- end
53
-
54
- it "#deviceid が nil を返すこと" do
55
- @mobile.deviceid.should be_nil
56
- end
57
-
58
- it "#ident でx-jphone-uidを取得できること" do
59
- @mobile.ident.should == @mobile.subscriberid
60
- @mobile.ident.should == 'c10Sty5bmqjsZeb2'
61
- end
62
- end
63
-
64
- describe "X-JPHONE-UIDの送出が禁止されているとき" do
65
-
66
- before(:each) do
67
- @env = Rack::MockRequest.env_for('http://hoge.com/dummy',
68
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/824T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1')
69
- @mobile = Rack::Ketai::Carrier::Softbank.new(@env)
70
- end
71
-
72
- it "#subscriberid が nil を返すこと" do
73
- @mobile.subscriberid.should be_nil
74
- end
75
-
76
- it "#deviceid で端末シリアル番号を取得できること" do
77
- @mobile.deviceid.should == '000000000000000'
78
- end
79
-
80
- it "#ident で端末シリアル番号を取得できること" do
81
- @mobile.ident.should == @mobile.deviceid
82
- @mobile.ident.should == '000000000000000'
83
- end
84
- end
85
-
86
- describe "端末シリアル番号もX-JPHONE-UIDも送出が禁止されているとき" do
87
-
88
- before(:each) do
89
- @env = Rack::MockRequest.env_for('http://hoge.com/dummy',
90
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/824T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1')
91
- @mobile = Rack::Ketai::Carrier::Softbank.new(@env)
92
- end
93
-
94
- it "#subscriberid が nil を返すこと" do
95
- @mobile.subscriberid.should be_nil
96
- end
97
-
98
- it "#deviceid が nil を返すこと" do
99
- @mobile.deviceid.should be_nil
100
- end
101
-
102
- it "#ident が nil を返すこと" do
103
- @mobile.ident.should be_nil
104
- end
105
- end
106
-
107
- describe "ディスプレイ情報を取得できること" do
108
-
109
- describe "既知の端末のとき" do
110
-
111
- it "環境変数を優先すること" do
112
- @env = Rack::MockRequest.env_for('http://hoge.com/dummy',
113
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/933SH/SHJ002[/Serial] Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1',
114
- 'HTTP_X_JPHONE_DISPLAY' => '1024*768',
115
- 'HTTP_X_JPHONE_COLOR' => 'C256')
116
- @mobile = Rack::Ketai::Carrier::Softbank.new(@env)
117
- display = @mobile.display
118
- display.should_not be_nil
119
- display.colors.should == 256
120
- display.width.should == 1024
121
- display.height.should == 768
122
-
123
- @env = Rack::MockRequest.env_for('http://hoge.com/dummy',
124
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/933SH/SHJ002[/Serial] Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1')
125
- @mobile = Rack::Ketai::Carrier::Softbank.new(@env)
126
- display = @mobile.display
127
- display.should_not be_nil
128
- display.colors.should == 16777216
129
- display.width.should == 480
130
- display.height.should == 738
131
- end
132
-
133
- end
134
-
135
- describe "未知の端末のとき" do
136
-
137
- it "環境変数から設定すること" do
138
- @env = Rack::MockRequest.env_for('http://hoge.com/dummy',
139
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/100XX/SHJ002[/Serial] Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1',
140
- 'HTTP_X_JPHONE_DISPLAY' => '1024*768',
141
- 'HTTP_X_JPHONE_COLOR' => 'C256')
142
- @mobile = Rack::Ketai::Carrier::Softbank.new(@env)
143
- display = @mobile.display
144
- display.should_not be_nil
145
- display.colors.should == 256
146
- display.width.should == 1024
147
- display.height.should == 768
148
- end
149
-
150
- it "環境変数が無かったら慌てず騒がず nil を返す" do
151
- @env = Rack::MockRequest.env_for('http://hoge.com/dummy',
152
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/100XX/SHJ002[/Serial] Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1')
153
- @mobile = Rack::Ketai::Carrier::Softbank.new(@env)
154
- display = @mobile.display
155
- display.should_not be_nil
156
- display.colors.should be_nil
157
- display.width.should be_nil
158
- display.height.should be_nil
159
- end
160
-
161
- end
162
-
163
- end
164
-
165
- end
166
-
167
- describe "#cache_size でキャッシュ容量を取得するとき" do
168
-
169
- it "データにないときは300KBに設定でOK" do
170
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
171
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/923SH/SHJ001/SN*************** Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1')
172
- mobile = Rack::Ketai::Carrier::Softbank.new(env)
173
- mobile.name.should == '923SH'
174
- mobile.cache_size.should == 300000
175
- end
176
-
177
- it "仕方ないので、データにあればそれを信用" do
178
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
179
- 'HTTP_USER_AGENT' => 'SoftBank/2.0/944SH/SHJ001/SN*************** Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1')
180
- mobile = Rack::Ketai::Carrier::Softbank.new(env)
181
- mobile.name.should == '944SH'
182
- mobile.cache_size.should == 500000
183
- end
184
-
185
- end
186
-
187
- describe "#supports_cookie? を使うとき" do
188
- # Softbank のCookie対応状況
189
- # W型、3GC型機種のみ対応…C型、P型もサービス終了につき、
190
- # 現状はすべて対応のはず
191
- it "#supports_cookie? は true を返す" do
192
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
193
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/930SH/SHJ001[/Serial] Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1')
194
- mobile = Rack::Ketai::Carrier::Softbank.new(env)
195
- mobile.should be_respond_to(:supports_cookie?)
196
- mobile.should be_supports_cookie
197
- end
198
- end
199
-
200
- it 'スマートフォンではないこと' do
201
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
202
- 'HTTP_USER_AGENT' => 'SoftBank/1.0/930SH/SHJ001[/Serial] Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1')
203
- mobile = Rack::Ketai::Carrier::Softbank.new(env)
204
- mobile.should_not be_smartphone
205
- end
206
-
207
- end
@@ -1,116 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'rack/ketai/carrier/docomo'
3
- describe "Rack::Ketai::Carrier::*.valid_addr? を使うとき" do
4
-
5
- def proxy_from(proxy_addr, carrier, addr)
6
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
7
- 'HTTP_USER_AGENT' => 'DoCoMo/1.0/N505i/c20/TB/W24H12',
8
- 'HTTP_X_DCMGUID' => '0123abC',
9
- 'REMOTE_ADDR' => proxy_addr,
10
- 'HTTP_X_FORWARDED_FOR' => [addr, proxy_addr].join(', '))
11
- carrier.new(env)
12
- end
13
-
14
- def from(carrier, addr)
15
- env = Rack::MockRequest.env_for('http://hoge.com/dummy',
16
- 'HTTP_USER_AGENT' => 'DoCoMo/1.0/N505i/c20/TB/W24H12',
17
- 'HTTP_X_DCMGUID' => '0123abC',
18
- 'REMOTE_ADDR' => addr)
19
- carrier.new(env)
20
- end
21
-
22
- CIDRS = {
23
- :Docomo => %w(
24
- 210.153.84.0/24
25
- 210.136.161.0/24
26
- 210.153.86.0/24
27
- 124.146.174.0/24
28
- 124.146.175.0/24
29
- 202.229.176.0/24
30
- 202.229.177.0/24
31
- 202.229.178.0/24
32
- ),
33
- :Au => %w(
34
- 210.230.128.224/28
35
- 121.111.227.160/27
36
- 61.117.1.0/28
37
- 219.108.158.0/27
38
- 219.125.146.0/28
39
- 61.117.2.32/29
40
- 61.117.2.40/29
41
- 219.108.158.40/29
42
- 219.125.148.0/25
43
- 222.5.63.0/25
44
- 222.5.63.128/25
45
- 222.5.62.128/25
46
- 59.135.38.128/25
47
- 219.108.157.0/25
48
- 219.125.145.0/25
49
- 121.111.231.0/25
50
- 121.111.227.0/25
51
- 118.152.214.192/26
52
- 118.159.131.0/25
53
- 118.159.133.0/25
54
- 118.159.132.160/27
55
- 111.86.142.0/26
56
- 111.86.141.64/26
57
- 111.86.141.128/26
58
- 111.86.141.192/26
59
- 118.159.133.192/26
60
- 111.86.143.192/27
61
- 111.86.143.224/27
62
- 111.86.147.0/27
63
- 111.86.142.128/27
64
- 111.86.142.160/27
65
- 111.86.142.192/27
66
- 111.86.142.224/27
67
- 111.86.143.0/27
68
- 111.86.143.32/27
69
- 111.86.147.32/27
70
- 111.86.147.64/27
71
- 111.86.147.96/27
72
- 111.86.147.128/27
73
- 111.86.147.160/27
74
- 111.86.147.192/27
75
- 111.86.147.224/27
76
- 111.107.116.0/26
77
- 111.107.116.64/26
78
- 111.107.116.192/28
79
- ),
80
- :Softbank => %w(
81
- 123.108.237.0/27
82
- 202.253.96.224/27
83
- 210.146.7.192/26
84
- )
85
- }.freeze
86
-
87
- it "キャリア指定のアドレス帯域からのアクセスであれば真を返すこと" do
88
- CIDRS.each do |carrier_name, cidrs|
89
- klass = Rack::Ketai::Carrier.const_get(carrier_name)
90
- cidrs.each do |cidr|
91
- addrs = IPAddr.new(cidr).to_range.to_a
92
- from(klass, addrs.first.to_s).should be_valid_addr
93
- from(klass, addrs[(addrs.size - 1)/2].to_s).should be_valid_addr
94
- from(klass, addrs.last.to_s).should be_valid_addr
95
- proxy_from('192.168.1.1', klass, addrs.first.to_s).should be_valid_addr # プロキシ越し
96
- end
97
- end
98
- end
99
-
100
- it "キャリア指定のアドレス帯域からのアクセスでなければ偽を返すこと" do
101
- CIDRS.each do |carrier_name, cidrs|
102
- ([Rack::Ketai::Carrier::Docomo,
103
- Rack::Ketai::Carrier::Au,
104
- Rack::Ketai::Carrier::Softbank] - [Rack::Ketai::Carrier.const_get(carrier_name)]).each do |klass|
105
- cidrs.each do |cidr|
106
- addrs = IPAddr.new(cidr).to_range.to_a
107
- from(klass, addrs.first.to_s).should_not be_valid_addr
108
- from(klass, addrs[(addrs.size - 1)/2].to_s).should_not be_valid_addr
109
- from(klass, addrs.last.to_s).should_not be_valid_addr
110
- proxy_from('192.168.1.1', klass, addrs.first.to_s).should_not be_valid_addr # プロキシ越し
111
- end
112
- end
113
- end
114
- end
115
-
116
- end