jpmobile 4.0.1 → 4.1.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG DELETED
@@ -1,11 +0,0 @@
1
- == 0.0.7
2
-
3
- * Rails 2.3.8 対応など
4
-
5
- == 0.0.3x 2008-09-26
6
-
7
- * メールアドレスからキャリアを判定する機能追加
8
-
9
- == 0.0.1 2007-06-16
10
-
11
- * Initial release
data/VERSION.yml DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- :major: 3
3
- :minor: 0
4
- :patch: 7
5
- :build:
data/install.rb DELETED
@@ -1 +0,0 @@
1
- # Install hook code here
@@ -1,45 +0,0 @@
1
- X-Account-Key: account2
2
- X-UIDL: UID44724-1271041990
3
- X-Mozilla-Status: 0001
4
- X-Mozilla-Status2: 10000000
5
- X-Mozilla-Keys:
6
- Return-Path: <info@jp.mobile>
7
- X-Original-To: info+to@jp.mobile
8
- Delivered-To: info+to@jp.mobile
9
- Received: from localhost (localhost [127.0.0.1])
10
- by mx1.jp.mobile (Postfix) with ESMTP id 916D982D3C
11
- for <info+to@jp.mobile>; Mon, 17 Jan 2011 16:43:00 +0900 (JST)
12
- Received: from mx1.jp.mobile ([127.0.0.1])
13
- by localhost (mx1.jp.mobile [127.0.0.1]) (amavisd-new, port 10024)
14
- with ESMTP id 4c+D+lqN6aOJ for <info+to@jp.mobile>;
15
- Mon, 17 Jan 2011 16:43:00 +0900 (JST)
16
- Received: by mx1.jp.mobile (Postfix, from userid 58)
17
- id 68BFD82D33; Mon, 17 Jan 2011 16:43:00 +0900 (JST)
18
- Message-ID: <4D33F300.8050702@jpmobile.jp>
19
- Date: Mon, 17 Jan 2011 16:42:56 +0900
20
- From: Shin-ichiro OGAWA <info@jpmobile.jp>
21
- User-Agent: Mozilla-Thunderbird 2.0.0.24 (X11/20100329)
22
- MIME-Version: 1.0
23
- To: info+to@jp.mobile
24
- Subject:
25
- Content-Type: multipart/mixed;
26
- boundary="------------010605060509040104050402"
27
-
28
- This is a multi-part message in MIME format.
29
- --------------010605060509040104050402
30
- Content-Type: text/plain; charset=ISO-2022-JP
31
- Content-Transfer-Encoding: 7bit
32
-
33
- $BK\J8$G$9(B
34
-
35
-
36
- --------------010605060509040104050402
37
- Content-Transfer-Encoding: base64
38
- Content-Type: image/gif;
39
- name="Transparent.gif"
40
- Content-Disposition: attachment;
41
- filename="Transparent.gif"
42
-
43
- R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
44
- --------------010605060509040104050402--
45
-
@@ -1,28 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path(File.join(File.dirname(__FILE__), '/../../spec_helper'))
3
-
4
- describe Admin::TopController do
5
- describe "GET 'full_path'" do
6
- context "PCからのアクセスの場合" do
7
- before do
8
- @user_agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)"
9
- end
10
- it '_partial.html.erbが使用されること' do
11
- get '/admin/top/full_path', {}, { "HTTP_USER_AGENT" => @user_agent}
12
-
13
- response.should have_tag("h2", :content => "_partial.html.erb")
14
- end
15
- end
16
-
17
- context "DoCoMoからのアクセスの場合" do
18
- before do
19
- @user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
20
- end
21
- it '_partial_mobile_docomo.html.erbが使用されること' do
22
- get '/admin/top/full_path', {}, { "HTTP_USER_AGENT" => @user_agent}
23
-
24
- response.should have_tag("h2", :content => "_partial_mobile_docomo.html.erb")
25
- end
26
- end
27
- end
28
- end
@@ -1,101 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path(File.join(File.dirname(__FILE__), '/../spec_helper'))
3
-
4
- shared_examples_for "docomo_guid が起動しないとき" do
5
- it "で link_to の自動書き換えが行われない" do
6
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
7
-
8
- response.should have_tag('a') do |a|
9
- a.first['href'].should match(/^\/.+?\/link$/)
10
- end
11
- end
12
- end
13
-
14
- shared_examples_for "docomo_guid が起動するとき" do
15
- it "で link_to の自動書き換えが行われる" do
16
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
17
-
18
- response.should have_tag('a') do |a|
19
- a.first['href'].should match(/^\/.+?\/link\?guid=ON$/)
20
- end
21
- end
22
- end
23
-
24
- describe DocomoGuidBaseController, "という docomo_guid が有効になっていないコントローラ" do
25
- before(:each) do
26
- @controller = "docomo_guid_base"
27
- @user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
28
- end
29
-
30
- it "の docomo_guid_mode は nil" do
31
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
32
-
33
- controller.docomo_guid_mode.should be_nil
34
- end
35
- it_should_behave_like "docomo_guid が起動しないとき"
36
- end
37
-
38
- describe DocomoGuidAlwaysController, "という docomo_guid :always が指定されているコントローラ" do
39
- before(:each) do
40
- @controller = "docomo_guid_always"
41
- @user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
42
- end
43
-
44
- it "の docomo_guid_always は :always" do
45
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
46
-
47
- controller.docomo_guid_mode.should == :always
48
- end
49
- it_should_behave_like "docomo_guid が起動するとき"
50
- end
51
-
52
- describe DocomoGuidDocomoController, "という docomo_guid :docomo が指定されているコントローラ" do
53
- before(:each) do
54
- @controller = "docomo_guid_docomo"
55
- @user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
56
- end
57
-
58
- it "の docomo_guid_mode は :docomo" do
59
- get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
60
-
61
- controller.docomo_guid_mode.should == :docomo
62
- end
63
- end
64
-
65
- def describe_mobile_with_ua(user_agent, &block)
66
- describe("docomo_guid :docomo が指定されているコントローラに #{user_agent} からアクセスしたとき") do
67
- before do
68
- @controller = "docomo_guid_docomo"
69
- @user_agent = user_agent
70
- end
71
- instance_eval(&block)
72
- end
73
- end
74
-
75
- describe_mobile_with_ua "DoCoMo/2.0 SH902i(c100;TB;W24H12)" do
76
- it_should_behave_like "docomo_guid が起動するとき"
77
- end
78
-
79
- describe_mobile_with_ua "J-PHONE/3.0/V301D" do
80
- it_should_behave_like "docomo_guid が起動しないとき"
81
- end
82
-
83
- describe_mobile_with_ua "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0" do
84
- it_should_behave_like "docomo_guid が起動しないとき"
85
- end
86
-
87
- describe_mobile_with_ua "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1" do
88
- it_should_behave_like "docomo_guid が起動しないとき"
89
- end
90
-
91
- describe_mobile_with_ua "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0" do
92
- it_should_behave_like "docomo_guid が起動しないとき"
93
- end
94
-
95
- describe_mobile_with_ua "DoCoMo/1.0/N505i/c20/TB/W20H10 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)" do
96
- it_should_behave_like "docomo_guid が起動しないとき"
97
- end
98
-
99
- describe_mobile_with_ua "DoCoMo/2.0/SO502i (compatible; Y!J-SRD/1.0; http://help.yahoo.co.jp/help/jp/search/indexing/indexing-27.html)" do
100
- it_should_behave_like "docomo_guid が起動しないとき"
101
- end
@@ -1,239 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path(File.join(File.dirname(__FILE__), '/../spec_helper'))
3
-
4
- describe "jpmobile integration spec" do
5
- include Jpmobile::Util
6
-
7
- shared_examples_for "hankaku_filter :input => true のとき" do
8
- it "はtextareaの中では半角に変換されないこと" do
9
- get "/#{@controller}/textarea", {}, {"HTTP_USER_AGENT" => @user_agent}
10
- body.should == send(@conversion_method, '<textarea hoge="fuu">アブラカダブラ</textarea>')
11
- end
12
- it "はinputのvalueの中では半角に変換されないこと" do
13
- get "/#{@controller}/input_tag", {}, {"HTTP_USER_AGENT" => @user_agent}
14
- body.should == send(@conversion_method, '<input hoge="fuu" value="アブラカダブラ">')
15
- end
16
- it "は&nbsp;変換されない" do
17
- get "/#{@controller}/nbsp_char", {}, {"HTTP_USER_AGENT" => @user_agent}
18
- body.should == send(@conversion_method, '<a>アブラ&nbsp;カダブラ</a>')
19
- end
20
- end
21
-
22
- shared_examples_for "hankaku_filter :input => false のとき" do
23
- it "はtextareaの中でも半角に変換されること" do
24
- get "/#{@controller}/textarea", {}, {"HTTP_USER_AGENT" => @user_agent}
25
- body.should == send(@conversion_method, '<textarea hoge="fuu">アブラカダブラ</textarea>')
26
- end
27
- it "はinputのvalueの中も半角に変換されること" do
28
- get "/#{@controller}/input_tag", {}, {"HTTP_USER_AGENT" => @user_agent}
29
- body.should == send(@conversion_method, '<input hoge="fuu" value="アブラカダブラ" />')
30
- end
31
- it "は&nbsp;変換されない" do
32
- get "/#{@controller}/nbsp_char", {}, {"HTTP_USER_AGENT" => @user_agent}
33
- body.should == send(@conversion_method, '<a>アブラ&nbsp;カダブラ</a>')
34
- end
35
- end
36
-
37
- shared_examples_for "文字コードフィルタが動作しているとき" do
38
- it "はhtml以外は変換しないこと" do
39
- get "/#{@controller}/rawdata", {}, {"HTTP_USER_AGENT" => @user_agent}
40
- body.should == "アブラカダブラ"
41
- headers['Content-Type'].should_not =~ /charset/i
42
- end
43
- it "response.bodyが空のときは文字コードを変更しないこと" do
44
- get "/#{@controller}/empty", {}, {"HTTP_USER_AGENT" => @user_agent}
45
- headers['Content-Type'].should =~ /utf-8/i
46
- end
47
- end
48
-
49
- shared_examples_for "Shift_JISで通信する端末との通信" do
50
- it "はShift_JISで携帯に送出されること" do
51
- get "/#{@controller}/abracadabra_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
52
- body.should == utf8_to_sjis("アブラカダブラ")
53
- headers['Content-Type'].should =~ /Shift_JIS/i
54
- end
55
- it "はxhtmlでもShift_JISで携帯に送出されること" do
56
- get "/#{@controller}/abracadabra_xhtml_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
57
-
58
- body.should == utf8_to_sjis("アブラカダブラ")
59
- headers['Content-Type'].should =~ /Shift_JIS/i
60
- end
61
- it "はShift_JISで渡されたパラメタがparamsにUTF-8に変換されて格納されること" do
62
- get "/#{@controller}", {:q => utf8_to_sjis("アブラカダブラ")}, {"HTTP_USER_AGENT" => @user_agent}
63
- assigns(:q).should == utf8("アブラカダブラ")
64
- end
65
- it "は半角カナのparamsを変換しないこと" do
66
- # アブラカダブラ半角,SJIS
67
- get "/#{@controller}", {:q => sjis("\261\314\336\327\266\300\336\314\336\327")}, {"HTTP_USER_AGENT" => @user_agent}
68
- assigns(:q).should == utf8("アブラカダブラ")
69
- end
70
- it_should_behave_like "文字コードフィルタが動作しているとき"
71
- end
72
-
73
- shared_examples_for "UTF-8で通信する端末との通信" do
74
- it "はUTF-8で携帯に送出されること" do
75
- get "/#{@controller}/abracadabra_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
76
- body.should == "アブラカダブラ"
77
- headers['Content-Type'].should =~ /utf-8/i
78
- end
79
- it "はxhtmlでもUTF-8で携帯に送出されること" do
80
- get "/#{@controller}/abracadabra_xhtml_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
81
- body.should == "アブラカダブラ"
82
- headers['Content-Type'].should =~ /utf-8/i
83
- end
84
- it "はparamsにUTF-8のまま格納されること" do
85
- get "/#{@controller}/index", {:q => "アブラカダブラ"}, {"HTTP_USER_AGENT" => @user_agent}
86
- assigns(:q).should == utf8("アブラカダブラ")
87
- end
88
- it "は半角カナのparamsを変換しないこと" do
89
- get "/#{@controller}/index", {:q => "アブラカダブラ"}, {"HTTP_USER_AGENT" => @user_agent}
90
- assigns(:q).should == utf8("アブラカダブラ")
91
- end
92
- it_should_behave_like "文字コードフィルタが動作しているとき"
93
- end
94
-
95
- shared_examples_for "Shift_JISで通信する端末との通信(半角変換付き)" do
96
- it "は半角に変換されShift_JISで携帯に送出されること" do
97
- get "/#{@controller}/abracadabra_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
98
- body.should == sjis("\261\314\336\327\266\300\336\314\336\327") # アブラカダブラ半角,SJIS
99
- headers['Content-Type'].should =~ /Shift_JIS/
100
- end
101
- it "はShift_JISで渡されたパラメタがparamsにUTF-8に変換されて格納されること" do
102
- get "/#{@controller}/index", {:q => utf8_to_sjis("アブラカダブラ")}, {"HTTP_USER_AGENT" => @user_agent}
103
- assigns(:q).should == utf8("アブラカダブラ")
104
- end
105
- it "は半角Shift_JISで渡されたパラメタがparamsに全角UTF-8に変換されて格納されること" do
106
- # アブラカダブラ半角,SJIS
107
- get "/#{@controller}/index", {:q => sjis("\261\314\336\327\266\300\336\314\336\327")}, {"HTTP_USER_AGENT" => @user_agent}
108
- assigns(:q).should == utf8("アブラカダブラ")
109
- end
110
- it_should_behave_like "文字コードフィルタが動作しているとき"
111
- end
112
-
113
- shared_examples_for "UTF-8で通信する端末との通信(半角変換付き)" do
114
- it "はUTF-8半角で携帯に送出されること" do
115
- get "/#{@controller}/abracadabra_utf8", {}, {"HTTP_USER_AGENT" => @user_agent}
116
- body.should == "アブラカダブラ"
117
- headers['Content-Type'].should =~ /utf-8/i
118
- end
119
- it "はparamsにUTF-8のまま格納されること" do
120
- get "/#{@controller}/index", {:q => "アブラカダブラ"}, {"HTTP_USER_AGENT" => @user_agent}
121
- assigns(:q).should == utf8("アブラカダブラ")
122
- end
123
- it "は半角で渡されたparamsを全角に変換して格納すること" do
124
- get "/#{@controller}/index", {:q => "アブラカダブラ"}, {"HTTP_USER_AGENT" => @user_agent}
125
- assigns(:q).should == utf8("アブラカダブラ")
126
- end
127
- it_should_behave_like "文字コードフィルタが動作しているとき"
128
- end
129
-
130
- #
131
- # PCからのアクセス
132
- #
133
- describe FilterController, "PCからのアクセス" do
134
- before(:each) do
135
- @user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
136
- @controller = "filter"
137
- end
138
- it_should_behave_like "UTF-8で通信する端末との通信"
139
- end
140
-
141
- describe HankakuFilterController, "PCからのアクセス" do
142
- before(:each) do
143
- @user_agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)"
144
- @controller = "hankaku_filter"
145
- end
146
- it_should_behave_like "UTF-8で通信する端末との通信"
147
- end
148
-
149
- #
150
- # 携帯からのアクセス
151
- #
152
- describe FilterController, "DoCoMo SH902i からのアクセス" do
153
- before do
154
- @user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
155
- @controller = "filter"
156
- end
157
- it_should_behave_like "Shift_JISで通信する端末との通信"
158
- end
159
-
160
- describe FilterController, "au CA32 からのアクセス" do
161
- before do
162
- @user_agent = "KDDI-CA32 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0"
163
- @controller = "filter"
164
- end
165
- it_should_behave_like "Shift_JISで通信する端末との通信"
166
- end
167
-
168
- describe FilterController, "Vodafone V903T からのアクセス" do
169
- before do
170
- @user_agent = "Vodafone/1.0/V903T/TJ001 Browser/VF-Browser/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0"
171
- @controller = "filter"
172
- end
173
- it_should_behave_like "UTF-8で通信する端末との通信"
174
- end
175
-
176
- describe FilterController, "SoftBank 910T からのアクセス" do
177
- before do
178
- @user_agent = "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
179
- @controller = "filter"
180
- end
181
- it_should_behave_like "UTF-8で通信する端末との通信"
182
- end
183
-
184
- #
185
- # 半角フィルタ
186
- #
187
- describe HankakuFilterController, "DoCoMo SH902i からのアクセス" do
188
- before do
189
- @user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
190
- @controller = "hankaku_filter"
191
- @conversion_method = :utf8_to_sjis
192
- end
193
- it_should_behave_like "Shift_JISで通信する端末との通信(半角変換付き)"
194
- it_should_behave_like "hankaku_filter :input => false のとき"
195
- end
196
-
197
- describe HankakuFilterController, "SoftBank 910T からのアクセス" do
198
- before do
199
- @user_agent = "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
200
- @controller = "hankaku_filter"
201
- @conversion_method = :utf8
202
- end
203
- it_should_behave_like "UTF-8で通信する端末との通信(半角変換付き)"
204
- it_should_behave_like "hankaku_filter :input => false のとき"
205
- end
206
-
207
- #
208
- # 半角フィルタ(input付き)
209
- #
210
- describe HankakuInputFilterController, "DoCoMo SH902i からのアクセス" do
211
- before do
212
- @user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
213
- @controller = "hankaku_input_filter"
214
- @conversion_method = :utf8_to_sjis
215
- end
216
- it_should_behave_like "Shift_JISで通信する端末との通信(半角変換付き)"
217
- it_should_behave_like "hankaku_filter :input => true のとき"
218
-
219
- it "Content-Type が Shift_JIS であること" do
220
- get "/#{@controller}/with_charset", {}, {"HTTP_USER_AGENT" => @user_agent}
221
- body.should match(/Shift_JIS/)
222
- end
223
- end
224
-
225
- describe HankakuInputFilterController, "SoftBank 910T からのアクセス" do
226
- before do
227
- @user_agent = "SoftBank/1.0/910T/TJ001/SN000000000000000 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
228
- @controller = "hankaku_input_filter"
229
- @conversion_method = :utf8
230
- end
231
- it_should_behave_like "UTF-8で通信する端末との通信(半角変換付き)"
232
- it_should_behave_like "hankaku_filter :input => true のとき"
233
-
234
- it "Content-Type が UTF-8 であること" do
235
- get "/#{@controller}/with_charset", {}, {"HTTP_USER_AGENT" => @user_agent}
236
- body.should match(/UTF-8/)
237
- end
238
- end
239
- end