jpmobile 4.1.1 → 4.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jpmobile.gemspec +2 -0
- data/lib/jpmobile/emoticon.rb +3 -3
- data/lib/jpmobile/filter.rb +1 -1
- data/lib/jpmobile/mail.rb +3 -3
- data/lib/jpmobile/mobile/abstract_mobile.rb +5 -2
- data/lib/jpmobile/resolver.rb +17 -1
- data/lib/jpmobile/version.rb +1 -1
- data/lib/tasks/jpmobile_tasks.rake +5 -11
- data/spec/rack/jpmobile/android_spec.rb +4 -4
- data/spec/rack/jpmobile/au_spec.rb +46 -46
- data/spec/rack/jpmobile/black_berry_spec.rb +4 -4
- data/spec/rack/jpmobile/docomo_spec.rb +52 -52
- data/spec/rack/jpmobile/emoticon_spec.rb +67 -67
- data/spec/rack/jpmobile/filter_spec.rb +36 -36
- data/spec/rack/jpmobile/iphone_spec.rb +5 -5
- data/spec/rack/jpmobile/mobile_by_ua_spec.rb +2 -2
- data/spec/rack/jpmobile/params_filter_spec.rb +30 -30
- data/spec/rack/jpmobile/softbank_spec.rb +39 -39
- data/spec/rack/jpmobile/willcom_spec.rb +12 -12
- data/spec/rack/jpmobile/windows_phone.rb +4 -4
- data/spec/unit/decorated_mail_spec.rb +3 -3
- data/spec/unit/email_spec.rb +6 -6
- data/spec/unit/emoticon_spec.rb +33 -33
- data/spec/unit/encoding_spec.rb +14 -14
- data/spec/unit/is_carrier_spec.rb +1 -1
- data/spec/unit/mail_spec.rb +63 -63
- data/spec/unit/mobile/iphone_spec.rb +6 -6
- data/spec/unit/receive_mail_spec.rb +75 -75
- data/spec/unit/util_spec.rb +34 -34
- data/spec/unit/valid_ip_spec.rb +2 -2
- data/spec/unit/variants_spec.rb +40 -10
- data/test/rails/overrides/Gemfile +3 -3
- data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +6 -6
- data/test/rails/overrides/spec/controllers/helpers_spec.rb +22 -22
- data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +19 -19
- data/test/rails/overrides/spec/controllers/template_path_spec.rb +8 -8
- data/test/rails/overrides/spec/controllers/trans_sid_controller_spec.rb +2 -2
- data/test/rails/overrides/spec/features/admin/top_spec.rb +3 -3
- data/test/rails/overrides/spec/features/filter_spec.rb +32 -32
- data/test/rails/overrides/spec/helpers/helpers_spec.rb +3 -3
- data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +3 -3
- data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +179 -179
- data/test/rails/overrides/spec/mailers/normal_mailer_spec.rb +7 -7
- data/test/rails/overrides/spec/requests/docomo_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/emobile_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/pc_spec.rb +3 -3
- data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/template_path_spec.rb +24 -24
- data/test/rails/overrides/spec/requests/trans_sid_spec.rb +16 -16
- metadata +39 -25
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe NormalMailer do
|
3
|
+
describe NormalMailer, :type => :mailer do
|
4
4
|
include Jpmobile::Util
|
5
5
|
|
6
6
|
before(:each) do
|
@@ -15,19 +15,19 @@ describe NormalMailer do
|
|
15
15
|
it "正常に送信できること" do
|
16
16
|
email = NormalMailer.msg(@to, "題名", "本文").deliver
|
17
17
|
|
18
|
-
ActionMailer::Base.deliveries.size.
|
19
|
-
(email.to - @to).
|
18
|
+
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
19
|
+
expect(email.to - @to).to be_empty
|
20
20
|
end
|
21
21
|
|
22
22
|
it "UTF-8のままであること" do
|
23
23
|
email = NormalMailer.msg(@to, @subject, @text).deliver
|
24
24
|
|
25
|
-
ActionMailer::Base.deliveries.size.
|
25
|
+
expect(ActionMailer::Base.deliveries.size).to eq(1)
|
26
26
|
|
27
27
|
raw_mail = ascii_8bit(email.to_s)
|
28
|
-
raw_mail.
|
29
|
-
raw_mail.
|
30
|
-
raw_mail.
|
28
|
+
expect(raw_mail).to match(/UTF-8/i)
|
29
|
+
expect(raw_mail).to match(Regexp.escape("=E6=97=A5=E6=9C=AC=E8=AA=9E=E9=A1=8C=E5=90=8D"))
|
30
|
+
expect(raw_mail).to match(Regexp.escape([@text].pack("m").strip))
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe "DoCoMo SH902i からのアクセス" do
|
3
|
+
describe "DoCoMo SH902i からのアクセス", :type => :request do
|
4
4
|
it "request.mobile は Docomo のインスタンスであるべき" do
|
5
5
|
get "/mobile_spec/index", {}, {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)"}
|
6
6
|
|
7
|
-
request.mobile.
|
7
|
+
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Docomo)
|
8
8
|
end
|
9
9
|
it "request.mobile? は true であるべき" do
|
10
10
|
get "/mobile_spec/index", {}, {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)"}
|
11
11
|
|
12
|
-
request.mobile
|
12
|
+
expect(request.mobile?).to be_truthy
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe "DoCoMo SH902i からguid付きのアクセス" do
|
16
|
+
describe "DoCoMo SH902i からguid付きのアクセス", :type => :request do
|
17
17
|
before(:each) do
|
18
18
|
@headers = {"HTTP_USER_AGENT" => "DoCoMo/2.0 SH902i(c100;TB;W24H12)", 'HTTP_X_DCMGUID' => "000000a"}
|
19
19
|
end
|
@@ -21,11 +21,11 @@ describe "DoCoMo SH902i からguid付きのアクセス" do
|
|
21
21
|
it "guidを正しく取得できること" do
|
22
22
|
get "/mobile_spec/index", {}, @headers
|
23
23
|
|
24
|
-
request.mobile.guid.
|
24
|
+
expect(request.mobile.guid).to eq("000000a")
|
25
25
|
end
|
26
26
|
it "ident_subscriberでも正しく取得できること" do
|
27
27
|
get "/mobile_spec/index", {}, @headers
|
28
28
|
|
29
|
-
request.mobile.ident_subscriber.
|
29
|
+
expect(request.mobile.ident_subscriber).to eq("000000a")
|
30
30
|
end
|
31
31
|
end
|
@@ -12,22 +12,22 @@ describe "H11T モバイルブラウザからのアクセス" do
|
|
12
12
|
it "request.mobile は Emobile のインスタンスであること" do
|
13
13
|
get "/mobile_spec/index", {}, @headers
|
14
14
|
|
15
|
-
request.mobile.
|
15
|
+
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Emobile)
|
16
16
|
end
|
17
17
|
it "request.mobile? は true であること" do
|
18
18
|
get "/mobile_spec/index", {}, @headers
|
19
19
|
|
20
|
-
request.mobile
|
20
|
+
expect(request.mobile?).to be_truthy
|
21
21
|
end
|
22
22
|
it "のsubscribe番号を取得できること" do
|
23
23
|
get "/mobile_spec/index", {}, @headers
|
24
24
|
|
25
|
-
request.mobile.ident_subscriber.
|
25
|
+
expect(request.mobile.ident_subscriber).to eq("u00000000000000000")
|
26
26
|
end
|
27
27
|
it "のIPアドレス空間を正しく検証できること" do
|
28
28
|
get "/mobile_spec/index", {}, @headers
|
29
29
|
|
30
|
-
request.mobile.valid_ip
|
30
|
+
expect(request.mobile.valid_ip?).to be_truthy
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -41,11 +41,11 @@ describe "S11HT からのアクセス" do
|
|
41
41
|
it "request.mobile は Emobile のインスタンスであること" do
|
42
42
|
get "/mobile_spec/index", {}, @headers
|
43
43
|
|
44
|
-
request.mobile.
|
44
|
+
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Emobile)
|
45
45
|
end
|
46
46
|
it "request.mobile? は true であること" do
|
47
47
|
get "/mobile_spec/index", {}, @headers
|
48
48
|
|
49
|
-
request.mobile
|
49
|
+
expect(request.mobile?).to be_truthy
|
50
50
|
end
|
51
51
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe "PCからのアクセスの場合" do
|
3
|
+
describe "PCからのアクセスの場合", :type => :request do
|
4
4
|
before do
|
5
5
|
@headers = {
|
6
6
|
"HTTP_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)",
|
@@ -10,11 +10,11 @@ describe "PCからのアクセスの場合" do
|
|
10
10
|
it "request.mobile は nil であるべき" do
|
11
11
|
get "/mobile_spec/index", {}, @headers
|
12
12
|
|
13
|
-
request.mobile.
|
13
|
+
expect(request.mobile).to be_nil
|
14
14
|
end
|
15
15
|
it "request.mobile? は false であるべき" do
|
16
16
|
get "/mobile_spec/index", {}, @headers
|
17
17
|
|
18
|
-
request.mobile
|
18
|
+
expect(request.mobile?).to be_falsey
|
19
19
|
end
|
20
20
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe "Softbank Emulator からのアクセスのとき" do
|
3
|
+
describe "Softbank Emulator からのアクセスのとき", :type => :request do
|
4
4
|
it "request.mobile は Softbank のインスタンスであること" do
|
5
5
|
get "/mobile_spec/index", {}, {"HTTP_USER_AGENT" => "Semulator"}
|
6
6
|
|
7
|
-
request.mobile.
|
8
|
-
request.mobile
|
7
|
+
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Softbank)
|
8
|
+
expect(request.mobile?).to be_truthy
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
describe "Vodafone Emulator からのアクセスのとき" do
|
12
|
+
describe "Vodafone Emulator からのアクセスのとき", :type => :request do
|
13
13
|
it "request.mobile は Vodafone のインスタンスであること" do
|
14
14
|
get "/mobile_spec/index", {}, {"HTTP_USER_AGENT" => "Vemulator"}
|
15
15
|
|
16
|
-
request.mobile.
|
17
|
-
request.mobile
|
16
|
+
expect(request.mobile).to be_an_instance_of(Jpmobile::Mobile::Vodafone)
|
17
|
+
expect(request.mobile?).to be_truthy
|
18
18
|
end
|
19
19
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe TemplatePathController, "integrated_views" do
|
3
|
+
describe TemplatePathController, "integrated_views", :type => :request do
|
4
4
|
before do
|
5
5
|
page.driver.header('User-Agent', user_agent)
|
6
6
|
end
|
@@ -13,7 +13,7 @@ describe TemplatePathController, "integrated_views" do
|
|
13
13
|
it 'index.html.erbが使用されること' do
|
14
14
|
visit "/template_path/index"
|
15
15
|
|
16
|
-
page.
|
16
|
+
expect(page).to have_content("index.html.erb")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -24,19 +24,19 @@ describe TemplatePathController, "integrated_views" do
|
|
24
24
|
it 'index_mobile_docomo.html.erbが使用されること' do
|
25
25
|
visit "/template_path/index"
|
26
26
|
|
27
|
-
page.
|
27
|
+
expect(page).to have_content("index_mobile_docomo.html.erb")
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'show.html.erb がなくとも show_mobile_docomo.html.erbが使用されること' do
|
31
31
|
visit "/template_path/show"
|
32
32
|
|
33
|
-
page.
|
33
|
+
expect(page).to have_content("show_mobile_docomo.html.erb")
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'disable_mobile_view! のときには index.html.erb が使用されること' do
|
37
37
|
visit "/template_path/index?pc=true"
|
38
38
|
|
39
|
-
page.
|
39
|
+
expect(page).to have_content("index.html.erb")
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -47,13 +47,13 @@ describe TemplatePathController, "integrated_views" do
|
|
47
47
|
it 'index_mobile.html.erbが使用されること' do
|
48
48
|
visit "/template_path/index"
|
49
49
|
|
50
|
-
page.
|
50
|
+
expect(page).to have_content("index_mobile.html.erb")
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'show.html.erb がなくとも show_mobile.html.erbが使用されること' do
|
54
54
|
visit "/template_path/show"
|
55
55
|
|
56
|
-
page.
|
56
|
+
expect(page).to have_content("show_mobile.html.erb")
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -64,7 +64,7 @@ describe TemplatePathController, "integrated_views" do
|
|
64
64
|
it 'smart_phone_iphone.html.erbが使用されること' do
|
65
65
|
visit "/template_path/index"
|
66
66
|
|
67
|
-
page.
|
67
|
+
expect(page).to have_content("smart_phone_iphone.html.erb")
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -75,7 +75,7 @@ describe TemplatePathController, "integrated_views" do
|
|
75
75
|
it 'smart_phone.html.erbが使用されること' do
|
76
76
|
visit "/template_path/index"
|
77
77
|
|
78
|
-
page.
|
78
|
+
expect(page).to have_content("smart_phone.html.erb")
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -86,7 +86,7 @@ describe TemplatePathController, "integrated_views" do
|
|
86
86
|
it 'smart_phone.html.erbが使用されること' do
|
87
87
|
visit "/template_path/index"
|
88
88
|
|
89
|
-
page.
|
89
|
+
expect(page).to have_content("smart_phone.html.erb")
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -99,7 +99,7 @@ describe TemplatePathController, "integrated_views" do
|
|
99
99
|
it 'smart_phone_only.html.erbが使用されること' do
|
100
100
|
visit '/template_path/smart_phone_only'
|
101
101
|
|
102
|
-
page.
|
102
|
+
expect(page).to have_content('smart_phone_only_smart_phone.html.erb')
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -110,7 +110,7 @@ describe TemplatePathController, "integrated_views" do
|
|
110
110
|
it 'smart_phone_only.html.erbが使用されること' do
|
111
111
|
visit '/template_path/smart_phone_only'
|
112
112
|
|
113
|
-
page.
|
113
|
+
expect(page).to have_content('smart_phone_only_smart_phone.html.erb')
|
114
114
|
end
|
115
115
|
end
|
116
116
|
end
|
@@ -123,7 +123,7 @@ describe TemplatePathController, "integrated_views" do
|
|
123
123
|
it 'with_tblt_tablet.html.erbが使用されること' do
|
124
124
|
visit '/template_path/with_tblt'
|
125
125
|
|
126
|
-
page.
|
126
|
+
expect(page).to have_content('with_tblt_tablet.html.erb')
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -134,7 +134,7 @@ describe TemplatePathController, "integrated_views" do
|
|
134
134
|
it 'with_tblt_tablet.html.erbが使用されること' do
|
135
135
|
visit '/template_path/with_tblt'
|
136
136
|
|
137
|
-
page.
|
137
|
+
expect(page).to have_content('with_tblt_tablet.html.erb')
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -147,7 +147,7 @@ describe TemplatePathController, "integrated_views" do
|
|
147
147
|
it 'with_ipd_tablet_ipad.html.erbが使用されること' do
|
148
148
|
visit '/template_path/with_ipd'
|
149
149
|
|
150
|
-
page.
|
150
|
+
expect(page).to have_content('with_ipd_tablet_ipad.html.erb')
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
@@ -158,7 +158,7 @@ describe TemplatePathController, "integrated_views" do
|
|
158
158
|
it 'with_ipd.html.erbが使用されること' do
|
159
159
|
visit '/template_path/with_ipd'
|
160
160
|
|
161
|
-
page.
|
161
|
+
expect(page).to have_content('with_ipd.html.erb')
|
162
162
|
end
|
163
163
|
end
|
164
164
|
end
|
@@ -171,7 +171,7 @@ describe TemplatePathController, "integrated_views" do
|
|
171
171
|
it '_partial.html.erbが使用されること' do
|
172
172
|
visit "/template_path/partial"
|
173
173
|
|
174
|
-
page.
|
174
|
+
expect(page).to have_content("_partial.html.erb")
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
@@ -182,7 +182,7 @@ describe TemplatePathController, "integrated_views" do
|
|
182
182
|
it '_partial_mobile_docomo.html.erbが使用されること' do
|
183
183
|
visit "/template_path/partial"
|
184
184
|
|
185
|
-
page.
|
185
|
+
expect(page).to have_content("_partial_mobile_docomo.html.erb")
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
@@ -193,7 +193,7 @@ describe TemplatePathController, "integrated_views" do
|
|
193
193
|
it '_partial_mobile.html.erbが使用されること' do
|
194
194
|
visit "/template_path/partial"
|
195
195
|
|
196
|
-
page.
|
196
|
+
expect(page).to have_content("_partial_mobile.html.erb")
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
@@ -204,7 +204,7 @@ describe TemplatePathController, "integrated_views" do
|
|
204
204
|
it '_partial_smart_phone_iphone.html.erbが使用されること' do
|
205
205
|
visit "/template_path/partial"
|
206
206
|
|
207
|
-
page.
|
207
|
+
expect(page).to have_content("_partial_smart_phone_iphone.html.erb")
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
@@ -215,7 +215,7 @@ describe TemplatePathController, "integrated_views" do
|
|
215
215
|
it '_partial_smart_phone.html.erbが使用されること' do
|
216
216
|
visit "/template_path/partial"
|
217
217
|
|
218
|
-
page.
|
218
|
+
expect(page).to have_content("_partial_smart_phone.html.erb")
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
@@ -226,7 +226,7 @@ describe TemplatePathController, "integrated_views" do
|
|
226
226
|
it '_partial_smart_phone.html.erbが使用されること' do
|
227
227
|
visit "/template_path/partial"
|
228
228
|
|
229
|
-
page.
|
229
|
+
expect(page).to have_content("_partial_smart_phone.html.erb")
|
230
230
|
end
|
231
231
|
end
|
232
232
|
end
|
@@ -239,7 +239,7 @@ describe TemplatePathController, "integrated_views" do
|
|
239
239
|
it '_partial.html.erbが使用されること' do
|
240
240
|
visit "/template_path/full_path_partial"
|
241
241
|
|
242
|
-
page.
|
242
|
+
expect(page).to have_content("_partial.html.erb")
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
@@ -250,7 +250,7 @@ describe TemplatePathController, "integrated_views" do
|
|
250
250
|
it '_partial_mobile_docomo.html.erbが使用されること' do
|
251
251
|
visit "/template_path/full_path_partial"
|
252
252
|
|
253
|
-
page.
|
253
|
+
expect(page).to have_content("_partial_mobile_docomo.html.erb")
|
254
254
|
end
|
255
255
|
end
|
256
256
|
end
|
@@ -18,7 +18,7 @@ def describe_mobile_with_ua(user_agent, charset, &block)
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
describe "trans_sid functional" do
|
21
|
+
describe "trans_sid functional", :type => :request do
|
22
22
|
before(:each) do
|
23
23
|
@user ||= User.create(:name => "hoge")
|
24
24
|
end
|
@@ -27,12 +27,12 @@ describe "trans_sid functional" do
|
|
27
27
|
it "で link_to の自動書き換えが行われない" do
|
28
28
|
res = get_with_session(@controller, "link", @user_agent)
|
29
29
|
|
30
|
-
res.response.body.
|
30
|
+
expect(res.response.body).to match(/<a href=\"\/.+?\/link\">linkto<\/a>/)
|
31
31
|
end
|
32
32
|
it "で form の自動書き換えが行われない" do
|
33
33
|
res = get_with_session(@controller, "form", @user_agent)
|
34
34
|
|
35
|
-
res.response.body.
|
35
|
+
expect(res.response.body).to match(/<form accept-charset="#{@charset}" action=\"\/.+?\/form\"/)
|
36
36
|
end
|
37
37
|
it "で redirect の自動書き換えが行われない" do
|
38
38
|
res = get_with_session(@controller, "redirect", @user_agent)
|
@@ -45,16 +45,16 @@ describe "trans_sid functional" do
|
|
45
45
|
it "で link_to の自動書き換えが行われる" do
|
46
46
|
res = get_with_session(@controller, "link", @user_agent)
|
47
47
|
|
48
|
-
res.response.body.
|
48
|
+
expect(res.response.body).to match(/<a href=\"\/.+?\/link\?_session_id=[a-zA-Z0-9]{32}\">linkto<\/a>/)
|
49
49
|
end
|
50
50
|
it "で form内にhiddenが差し込まれる" do
|
51
51
|
res = get_with_session(@controller, "form", @user_agent)
|
52
|
-
res.response.body.
|
52
|
+
expect(res.response.body).to match(/<input type=\"hidden\" name=\".+\" value=\"[a-zA-Z0-9]{32}\"/)
|
53
53
|
end
|
54
54
|
it "で form の自動書き換えが行われる" do
|
55
55
|
res = get_with_session(@controller, "form", @user_agent)
|
56
56
|
|
57
|
-
res.response.body.
|
57
|
+
expect(res.response.body).to match(/<form accept-charset="#{@charset}" action=\"\/.+?\/form\?_session_id=[a-zA-Z0-9]{32}\"/)
|
58
58
|
end
|
59
59
|
it "で redirect の自動書き換えが行われる" do
|
60
60
|
res = get_with_session(@controller, "redirect", @user_agent)
|
@@ -66,12 +66,12 @@ describe "trans_sid functional" do
|
|
66
66
|
it "で @user の link_to の自動書き換えが行われる" do
|
67
67
|
res = get_with_session(@controller, "link_path", @user_agent)
|
68
68
|
|
69
|
-
res.response.body.
|
69
|
+
expect(res.response.body).to match(/<a href=\"\/users\/1\?_session_id=[a-zA-Z0-9]{32}\">linkto<\/a>/)
|
70
70
|
end
|
71
71
|
it "で @user の form の自動書き換えが行われる" do
|
72
72
|
res = get_with_session(@controller, "form_path", @user_agent)
|
73
73
|
|
74
|
-
res.response.body.
|
74
|
+
expect(res.response.body).to match(/<form accept-charset="#{@charset}" action=\"\/users\/1\?_session_id=[a-zA-Z0-9]{32}\"/)
|
75
75
|
end
|
76
76
|
it "で @path の redirect の自動書き換えが行われる" do
|
77
77
|
res = get_with_session(@controller, "redirect_path", @user_agent)
|
@@ -83,12 +83,12 @@ describe "trans_sid functional" do
|
|
83
83
|
it "で [:admin, @user] の link_to の自動書き換えが行われる" do
|
84
84
|
res = get_with_session(@controller, "link_path_admin", @user_agent)
|
85
85
|
|
86
|
-
res.response.body.
|
86
|
+
expect(res.response.body).to match(/<a href=\"\/admin\/users\/1\?_session_id=[a-zA-Z0-9]{32}\">linkto<\/a>/)
|
87
87
|
end
|
88
88
|
it "で [:admin, @user] の form の自動書き換えが行われる" do
|
89
89
|
res = get_with_session(@controller, "form_path_admin", @user_agent)
|
90
90
|
|
91
|
-
res.response.body.
|
91
|
+
expect(res.response.body).to match(/<form accept-charset="#{@charset}" action=\"\/admin\/users\/1\?_session_id=[a-zA-Z0-9]{32}\"/)
|
92
92
|
end
|
93
93
|
it "で [:admin, @path] の redirect の自動書き換えが行われる" do
|
94
94
|
res = get_with_session(@controller, "redirect_path_admin", @user_agent)
|
@@ -107,7 +107,7 @@ describe "trans_sid functional" do
|
|
107
107
|
it "の trans_sid_mode は nil" do
|
108
108
|
get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
|
109
109
|
|
110
|
-
controller.trans_sid_mode.
|
110
|
+
expect(controller.trans_sid_mode).to be_nil
|
111
111
|
end
|
112
112
|
it_should_behave_like "trans_sid が起動しないとき"
|
113
113
|
end
|
@@ -122,7 +122,7 @@ describe "trans_sid functional" do
|
|
122
122
|
it "の trans_sid_mode は :none" do
|
123
123
|
get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
|
124
124
|
|
125
|
-
controller.trans_sid_mode.
|
125
|
+
expect(controller.trans_sid_mode).to eq(:none)
|
126
126
|
end
|
127
127
|
it_should_behave_like "trans_sid が起動しないとき"
|
128
128
|
end
|
@@ -137,7 +137,7 @@ describe "trans_sid functional" do
|
|
137
137
|
it "の trans_sid_mode は :always" do
|
138
138
|
get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
|
139
139
|
|
140
|
-
controller.trans_sid_mode.
|
140
|
+
expect(controller.trans_sid_mode).to eq(:always)
|
141
141
|
end
|
142
142
|
it_should_behave_like "trans_sid が起動するとき"
|
143
143
|
end
|
@@ -152,7 +152,7 @@ describe "trans_sid functional" do
|
|
152
152
|
it "で redirect_to がエラーにならない" do
|
153
153
|
res = get_with_session(@controller, "redirect", @user_agent)
|
154
154
|
|
155
|
-
res.response.
|
155
|
+
expect(res.response).to be_redirect
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
@@ -166,7 +166,7 @@ describe "trans_sid functional" do
|
|
166
166
|
it "の trans_sid_mode は :mobile" do
|
167
167
|
get "/#{@controller}/link", {}, {"HTTP_USER_AGENT" => @user_agent}
|
168
168
|
|
169
|
-
controller.trans_sid_mode.
|
169
|
+
expect(controller.trans_sid_mode).to eq(:mobile)
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -180,7 +180,7 @@ describe "trans_sid functional" do
|
|
180
180
|
it "の trans_sid_mode は :always" do
|
181
181
|
res = get_with_session(@controller, "link", @user_agent)
|
182
182
|
|
183
|
-
res.controller.trans_sid_mode.
|
183
|
+
expect(res.controller.trans_sid_mode).to eq(:always)
|
184
184
|
end
|
185
185
|
it_should_behave_like "trans_sid が起動しないとき"
|
186
186
|
end
|