jpmobile 4.1.1 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/jpmobile.gemspec +2 -0
  3. data/lib/jpmobile/emoticon.rb +3 -3
  4. data/lib/jpmobile/filter.rb +1 -1
  5. data/lib/jpmobile/mail.rb +3 -3
  6. data/lib/jpmobile/mobile/abstract_mobile.rb +5 -2
  7. data/lib/jpmobile/resolver.rb +17 -1
  8. data/lib/jpmobile/version.rb +1 -1
  9. data/lib/tasks/jpmobile_tasks.rake +5 -11
  10. data/spec/rack/jpmobile/android_spec.rb +4 -4
  11. data/spec/rack/jpmobile/au_spec.rb +46 -46
  12. data/spec/rack/jpmobile/black_berry_spec.rb +4 -4
  13. data/spec/rack/jpmobile/docomo_spec.rb +52 -52
  14. data/spec/rack/jpmobile/emoticon_spec.rb +67 -67
  15. data/spec/rack/jpmobile/filter_spec.rb +36 -36
  16. data/spec/rack/jpmobile/iphone_spec.rb +5 -5
  17. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +2 -2
  18. data/spec/rack/jpmobile/params_filter_spec.rb +30 -30
  19. data/spec/rack/jpmobile/softbank_spec.rb +39 -39
  20. data/spec/rack/jpmobile/willcom_spec.rb +12 -12
  21. data/spec/rack/jpmobile/windows_phone.rb +4 -4
  22. data/spec/unit/decorated_mail_spec.rb +3 -3
  23. data/spec/unit/email_spec.rb +6 -6
  24. data/spec/unit/emoticon_spec.rb +33 -33
  25. data/spec/unit/encoding_spec.rb +14 -14
  26. data/spec/unit/is_carrier_spec.rb +1 -1
  27. data/spec/unit/mail_spec.rb +63 -63
  28. data/spec/unit/mobile/iphone_spec.rb +6 -6
  29. data/spec/unit/receive_mail_spec.rb +75 -75
  30. data/spec/unit/util_spec.rb +34 -34
  31. data/spec/unit/valid_ip_spec.rb +2 -2
  32. data/spec/unit/variants_spec.rb +40 -10
  33. data/test/rails/overrides/Gemfile +3 -3
  34. data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +6 -6
  35. data/test/rails/overrides/spec/controllers/helpers_spec.rb +22 -22
  36. data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +19 -19
  37. data/test/rails/overrides/spec/controllers/template_path_spec.rb +8 -8
  38. data/test/rails/overrides/spec/controllers/trans_sid_controller_spec.rb +2 -2
  39. data/test/rails/overrides/spec/features/admin/top_spec.rb +3 -3
  40. data/test/rails/overrides/spec/features/filter_spec.rb +32 -32
  41. data/test/rails/overrides/spec/helpers/helpers_spec.rb +3 -3
  42. data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +3 -3
  43. data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +179 -179
  44. data/test/rails/overrides/spec/mailers/normal_mailer_spec.rb +7 -7
  45. data/test/rails/overrides/spec/requests/docomo_spec.rb +6 -6
  46. data/test/rails/overrides/spec/requests/emobile_spec.rb +6 -6
  47. data/test/rails/overrides/spec/requests/pc_spec.rb +3 -3
  48. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +6 -6
  49. data/test/rails/overrides/spec/requests/template_path_spec.rb +24 -24
  50. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +16 -16
  51. metadata +39 -25
@@ -7,11 +7,17 @@ describe Jpmobile::Mobile::AbstractMobile do
7
7
  subject{ Jpmobile::Mobile::AbstractMobile.new(nil, nil) }
8
8
 
9
9
  describe '#variants' do
10
- its(:variants){ should === ['mobile'] }
10
+ describe '#variants' do
11
+ subject { super().variants }
12
+ it { is_expected.to be === ['mobile'] }
13
+ end
11
14
  end
12
15
 
13
16
  describe '#mail_variants' do
14
- its(:mail_variants){ should == [] }
17
+ describe '#mail_variants' do
18
+ subject { super().mail_variants }
19
+ it { is_expected.to eq([]) }
20
+ end
15
21
  end
16
22
  end
17
23
 
@@ -19,7 +25,10 @@ describe Jpmobile::Mobile::Docomo do
19
25
  subject{ Jpmobile::Mobile::Docomo.new(nil, nil) }
20
26
 
21
27
  describe '#variants' do
22
- its(:variants){ should == ['mobile_docomo', 'mobile'] }
28
+ describe '#variants' do
29
+ subject { super().variants }
30
+ it { is_expected.to eq(['mobile_docomo', 'mobile']) }
31
+ end
23
32
  end
24
33
 
25
34
  describe '#mail_variants' do
@@ -33,7 +42,10 @@ describe Jpmobile::Mobile::Au do
33
42
  subject{ Jpmobile::Mobile::Au.new(nil, nil) }
34
43
 
35
44
  describe '#variants' do
36
- its(:variants){ should == ['mobile_au', 'mobile'] }
45
+ describe '#variants' do
46
+ subject { super().variants }
47
+ it { is_expected.to eq(['mobile_au', 'mobile']) }
48
+ end
37
49
  end
38
50
 
39
51
  describe '#mail_variants' do
@@ -47,7 +59,10 @@ describe Jpmobile::Mobile::Softbank do
47
59
  subject{ Jpmobile::Mobile::Softbank.new(nil, nil) }
48
60
 
49
61
  describe '#variants' do
50
- its(:variants){ should == ['mobile_softbank', 'mobile'] }
62
+ describe '#variants' do
63
+ subject { super().variants }
64
+ it { is_expected.to eq(['mobile_softbank', 'mobile']) }
65
+ end
51
66
  end
52
67
 
53
68
  describe '#mail_variants' do
@@ -61,7 +76,10 @@ describe Jpmobile::Mobile::Android do
61
76
  subject{ Jpmobile::Mobile::Android.new(nil, nil) }
62
77
 
63
78
  describe '#variants' do
64
- its(:variants){ should == ['smart_phone_android', 'smart_phone'] }
79
+ describe '#variants' do
80
+ subject { super().variants }
81
+ it { is_expected.to eq(['smart_phone_android', 'smart_phone']) }
82
+ end
65
83
  end
66
84
 
67
85
  describe '#mail_variants' do
@@ -75,7 +93,10 @@ describe Jpmobile::Mobile::AndroidTablet do
75
93
  subject{ Jpmobile::Mobile::AndroidTablet.new(nil, nil) }
76
94
 
77
95
  describe '#variants' do
78
- its(:variants){ should == ['tablet_android_tablet', 'tablet', 'smart_phone'] }
96
+ describe '#variants' do
97
+ subject { super().variants }
98
+ it { is_expected.to eq(['tablet_android_tablet', 'tablet', 'smart_phone']) }
99
+ end
79
100
  end
80
101
 
81
102
  describe '#mail_variants' do
@@ -89,7 +110,10 @@ describe Jpmobile::Mobile::Iphone do
89
110
  subject{ Jpmobile::Mobile::Iphone.new(nil, nil) }
90
111
 
91
112
  describe '#variants' do
92
- its(:variants) { should == ['smart_phone_iphone', 'smart_phone'] }
113
+ describe '#variants' do
114
+ subject { super().variants }
115
+ it { is_expected.to eq(['smart_phone_iphone', 'smart_phone']) }
116
+ end
93
117
  end
94
118
 
95
119
  describe '#mail_variants' do
@@ -103,7 +127,10 @@ describe Jpmobile::Mobile::Ipad do
103
127
  subject{ Jpmobile::Mobile::Ipad.new(nil, nil) }
104
128
 
105
129
  describe '#variants' do
106
- its(:variants){ should == ['tablet_ipad', 'tablet', 'smart_phone'] }
130
+ describe '#variants' do
131
+ subject { super().variants }
132
+ it { is_expected.to eq(['tablet_ipad', 'tablet', 'smart_phone']) }
133
+ end
107
134
  end
108
135
 
109
136
  describe '#mail_variants' do
@@ -117,7 +144,10 @@ describe Jpmobile::Mobile::WindowsPhone do
117
144
  subject{ Jpmobile::Mobile::WindowsPhone.new(nil, nil) }
118
145
 
119
146
  describe '#variants' do
120
- its(:variants){ should == ['smart_phone_windows_phone', 'smart_phone'] }
147
+ describe '#variants' do
148
+ subject { super().variants }
149
+ it { is_expected.to eq(['smart_phone_windows_phone', 'smart_phone']) }
150
+ end
121
151
  end
122
152
 
123
153
  describe '#mail_variants' do
@@ -40,9 +40,9 @@ gem 'spring', group: :development
40
40
 
41
41
  gem 'geokit'
42
42
 
43
- gem 'jpmobile', :path => '../../../'
44
- gem 'jpmobile-terminfo', :path => '../../../vendor/jpmobile-terminfo'
45
- gem 'jpmobile-ipaddresses', :path => '../../../vendor/jpmobile-ipaddresses'
43
+ gem 'jpmobile', path: './vendor/jpmobile'
44
+ gem 'jpmobile-terminfo', path: './vendor/jpmobile-terminfo'
45
+ gem 'jpmobile-ipaddresses', path: './vendor/jpmobile-ipaddresses'
46
46
 
47
47
  gem 'activerecord-session_store'
48
48
 
@@ -19,7 +19,7 @@ shared_examples_for "docomo_guid が起動するとき" do
19
19
  end
20
20
  end
21
21
 
22
- describe DocomoGuidBaseController do
22
+ describe DocomoGuidBaseController, :type => :controller do
23
23
  before(:each) do
24
24
  request.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)"
25
25
  end
@@ -27,12 +27,12 @@ describe DocomoGuidBaseController do
27
27
  it "の docomo_guid_mode は nil" do
28
28
  get :link
29
29
 
30
- controller.docomo_guid_mode.should be_nil
30
+ expect(controller.docomo_guid_mode).to be_nil
31
31
  end
32
32
  it_should_behave_like "docomo_guid が起動しないとき"
33
33
  end
34
34
 
35
- describe DocomoGuidAlwaysController do
35
+ describe DocomoGuidAlwaysController, :type => :controller do
36
36
  before(:each) do
37
37
  request.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)"
38
38
  end
@@ -40,12 +40,12 @@ describe DocomoGuidAlwaysController do
40
40
  it "の docomo_guid_always は :always" do
41
41
  get :link
42
42
 
43
- controller.docomo_guid_mode.should == :always
43
+ expect(controller.docomo_guid_mode).to eq(:always)
44
44
  end
45
45
  it_should_behave_like "docomo_guid が起動するとき"
46
46
  end
47
47
 
48
- describe DocomoGuidDocomoController do
48
+ describe DocomoGuidDocomoController, :type => :controller do
49
49
  before(:each) do
50
50
  request.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)"
51
51
  end
@@ -53,7 +53,7 @@ describe DocomoGuidDocomoController do
53
53
  it "の docomo_guid_mode は :docomo" do
54
54
  get :link
55
55
 
56
- controller.docomo_guid_mode.should == :docomo
56
+ expect(controller.docomo_guid_mode).to eq(:docomo)
57
57
  end
58
58
 
59
59
  shared_examples_for 'describe_mobile_with_ua' do |user_agent, example_name|
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe LinksController do
3
+ describe LinksController, :type => :controller do
4
4
  render_views
5
5
 
6
6
  # 文字列 +str+ 中に含まれるリンクについて、
@@ -18,9 +18,9 @@ describe LinksController do
18
18
 
19
19
  it "get_position_link_to_がエラー無く終わるか" do
20
20
  request.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)"
21
- lambda {
21
+ expect {
22
22
  get :show_all
23
- }.should_not raise_error
23
+ }.not_to raise_error
24
24
  end
25
25
 
26
26
  context "docomo で" do
@@ -29,11 +29,11 @@ describe LinksController do
29
29
  get :link
30
30
  links = get_href_and_texts(response.body)
31
31
 
32
- links.size.should == 1
32
+ expect(links.size).to eq(1)
33
33
  text, attrs, path, params = links.first
34
- text.should == "STRING"
35
- path.should == "http://test.host/links/link"
36
- response.body.should =~ /lcs>/
34
+ expect(text).to eq("STRING")
35
+ expect(path).to eq("http://test.host/links/link")
36
+ expect(response.body).to match(/lcs>/)
37
37
  end
38
38
 
39
39
  it "docomo_utn_link_to が正しく出力されること" do
@@ -41,11 +41,11 @@ describe LinksController do
41
41
  get :docomo_utn
42
42
  links = get_href_and_texts(response.body)
43
43
 
44
- links.size.should == 1
44
+ expect(links.size).to eq(1)
45
45
  text, attrs, path, params = links.first
46
- text.should == "STRING"
47
- path.should == "http://test.host/links/docomo_utn"
48
- response.body.should =~ /utn>/
46
+ expect(text).to eq("STRING")
47
+ expect(path).to eq("http://test.host/links/docomo_utn")
48
+ expect(response.body).to match(/utn>/)
49
49
  end
50
50
 
51
51
  it "オープンiエリア取得用のリンクが正しく出力されること" do
@@ -53,14 +53,14 @@ describe LinksController do
53
53
  get :docomo_openiarea
54
54
  links = get_href_and_texts(response.body)
55
55
 
56
- links.size.should == 1
56
+ expect(links.size).to eq(1)
57
57
  text, attrs, path, params = links.first
58
- text.should == "STRING"
59
- path.should == "http://w1m.docomo.ne.jp/cp/iarea"
60
- params["ecode"].should == "OPENAREACODE"
61
- params["msn"].should == "OPENAREAKEY"
62
- params["posinfo"].should == "1"
63
- params["nl"].should == "http://test.host/links/docomo_openiarea"
58
+ expect(text).to eq("STRING")
59
+ expect(path).to eq("http://w1m.docomo.ne.jp/cp/iarea")
60
+ expect(params["ecode"]).to eq("OPENAREACODE")
61
+ expect(params["msn"]).to eq("OPENAREAKEY")
62
+ expect(params["posinfo"]).to eq("1")
63
+ expect(params["nl"]).to eq("http://test.host/links/docomo_openiarea")
64
64
  end
65
65
 
66
66
  it "GPS取得用のリンクが正しく出力されること" do
@@ -68,11 +68,11 @@ describe LinksController do
68
68
  get :docomo_foma_gps
69
69
  links = get_href_and_texts(response.body)
70
70
 
71
- links.size.should == 1
71
+ expect(links.size).to eq(1)
72
72
  text, attrs, path, params = links.first
73
- text.should == "STRING"
74
- path.should == "http://test.host/links/docomo_foma_gps"
75
- response.body.should =~ /lcs>/
73
+ expect(text).to eq("STRING")
74
+ expect(path).to eq("http://test.host/links/docomo_foma_gps")
75
+ expect(response.body).to match(/lcs>/)
76
76
  end
77
77
  end
78
78
 
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe MobileSpecController do
3
+ describe MobileSpecController, :type => :controller do
4
4
  render_views
5
5
 
6
6
  describe "GET 'index'" do
@@ -9,9 +9,9 @@ describe MobileSpecController do
9
9
  request.user_agent = 'Mozilla'
10
10
  get 'index'
11
11
 
12
- response.should be_success
13
- response.should render_template('index')
14
- request.mobile?.should be_falsey
12
+ expect(response).to be_success
13
+ expect(response).to render_template('index')
14
+ expect(request.mobile?).to be_falsey
15
15
  end
16
16
  end
17
17
 
@@ -19,10 +19,10 @@ describe MobileSpecController do
19
19
  it "should be successful" do
20
20
  request.user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
21
21
  get 'index'
22
- response.should be_success
23
- response.should render_template('index_mobile')
24
- request.mobile?.should be_truthy
25
- request.mobile.should be_a(Jpmobile::Mobile::Docomo)
22
+ expect(response).to be_success
23
+ expect(response).to render_template('index_mobile')
24
+ expect(request.mobile?).to be_truthy
25
+ expect(request.mobile).to be_a(Jpmobile::Mobile::Docomo)
26
26
  end
27
27
  end
28
28
  end
@@ -33,9 +33,9 @@ describe MobileSpecController do
33
33
  request.user_agent = 'Mozilla'
34
34
  get 'file_render'
35
35
 
36
- response.should be_success
37
- response.body.should match('The change you wanted was rejected')
38
- request.mobile?.should be_falsey
36
+ expect(response).to be_success
37
+ expect(response.body).to match('The change you wanted was rejected')
38
+ expect(request.mobile?).to be_falsey
39
39
  end
40
40
  end
41
41
 
@@ -44,10 +44,10 @@ describe MobileSpecController do
44
44
  request.user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
45
45
  get 'file_render'
46
46
 
47
- response.should be_success
48
- response.body.should match('The change you wanted was rejected')
49
- request.mobile?.should be_truthy
50
- request.mobile.should be_a(Jpmobile::Mobile::Docomo)
47
+ expect(response).to be_success
48
+ expect(response.body).to match('The change you wanted was rejected')
49
+ expect(request.mobile?).to be_truthy
50
+ expect(request.mobile).to be_a(Jpmobile::Mobile::Docomo)
51
51
  end
52
52
  end
53
53
  end
@@ -67,8 +67,8 @@ describe MobileSpecController do
67
67
  request.user_agent = 'Mozilla'
68
68
  get 'no_mobile'
69
69
 
70
- response.should be_success
71
- response.body.should_not match('RailsRoot PC mobile')
70
+ expect(response).to be_success
71
+ expect(response.body).not_to match('RailsRoot PC mobile')
72
72
  end
73
73
  end
74
74
 
@@ -77,8 +77,8 @@ describe MobileSpecController do
77
77
  request.user_agent = "DoCoMo/2.0 SH902i(c100;TB;W24H12)"
78
78
  get 'no_mobile'
79
79
 
80
- response.should be_success
81
- response.body.should_not match('RailsRoot mobile')
80
+ expect(response).to be_success
81
+ expect(response.body).not_to match('RailsRoot mobile')
82
82
  end
83
83
  end
84
84
  end
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe TemplatePathController do
3
+ describe TemplatePathController, :type => :controller do
4
4
  before do
5
5
  request.user_agent = user_agent
6
6
  end
@@ -13,7 +13,7 @@ describe TemplatePathController do
13
13
  it 'テンプレートの探索順が正しいこと' do
14
14
  get :index
15
15
 
16
- controller.lookup_context.mobile.should == [ 'mobile_docomo', 'mobile' ]
16
+ expect(controller.lookup_context.mobile).to eq([ 'mobile_docomo', 'mobile' ])
17
17
  end
18
18
  end
19
19
 
@@ -24,7 +24,7 @@ describe TemplatePathController do
24
24
  it 'テンプレートの探索順が正しいこと' do
25
25
  get :index
26
26
 
27
- controller.lookup_context.mobile.should == [ 'mobile_au', 'mobile' ]
27
+ expect(controller.lookup_context.mobile).to eq([ 'mobile_au', 'mobile' ])
28
28
  end
29
29
  end
30
30
 
@@ -35,7 +35,7 @@ describe TemplatePathController do
35
35
  it 'テンプレートの探索順が正しいこと' do
36
36
  get :index
37
37
 
38
- controller.lookup_context.mobile.should == [ 'mobile_vodafone', 'mobile_softbank', 'mobile' ]
38
+ expect(controller.lookup_context.mobile).to eq([ 'mobile_vodafone', 'mobile_softbank', 'mobile' ])
39
39
  end
40
40
  end
41
41
 
@@ -46,7 +46,7 @@ describe TemplatePathController do
46
46
  it 'テンプレートの探索順が正しいこと' do
47
47
  get :index
48
48
 
49
- controller.lookup_context.mobile.should == [ 'mobile_softbank', 'mobile' ]
49
+ expect(controller.lookup_context.mobile).to eq([ 'mobile_softbank', 'mobile' ])
50
50
  end
51
51
  end
52
52
 
@@ -57,7 +57,7 @@ describe TemplatePathController do
57
57
  it 'テンプレートの探索順が正しいこと' do
58
58
  get :index
59
59
 
60
- controller.lookup_context.mobile.should == [ 'smart_phone_iphone', 'smart_phone' ]
60
+ expect(controller.lookup_context.mobile).to eq([ 'smart_phone_iphone', 'smart_phone' ])
61
61
  end
62
62
  end
63
63
 
@@ -68,7 +68,7 @@ describe TemplatePathController do
68
68
  it 'テンプレートの探索順が正しいこと' do
69
69
  get :index
70
70
 
71
- controller.lookup_context.mobile.should == [ 'smart_phone_android', 'smart_phone' ]
71
+ expect(controller.lookup_context.mobile).to eq([ 'smart_phone_android', 'smart_phone' ])
72
72
  end
73
73
  end
74
74
 
@@ -79,7 +79,7 @@ describe TemplatePathController do
79
79
  it 'テンプレートの探索順が正しいこと' do
80
80
  get :index
81
81
 
82
- controller.lookup_context.mobile.should == [ 'smart_phone_windows_phone', 'smart_phone' ]
82
+ expect(controller.lookup_context.mobile).to eq([ 'smart_phone_windows_phone', 'smart_phone' ])
83
83
  end
84
84
  end
85
85
  end
@@ -1,10 +1,10 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe TransSidAlwaysController do
3
+ describe TransSidAlwaysController, :type => :controller do
4
4
  describe "GET 'redirect_action'" do
5
5
  it "redirects 'form'" do
6
6
  get :redirect_action
7
- response.should redirect_to(:action => 'form')
7
+ expect(response).to redirect_to(:action => 'form')
8
8
  end
9
9
  end
10
10
  end
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe Admin::TopController do
3
+ describe Admin::TopController, :type => :feature do
4
4
  describe "GET 'full_path'" do
5
5
  before do
6
6
  page.driver.header('user_agent', user_agent)
@@ -13,7 +13,7 @@ describe Admin::TopController do
13
13
  it '_partial.html.erbが使用されること' do
14
14
  visit '/admin/top/full_path'
15
15
 
16
- page.should have_content("_partial.html.erb")
16
+ expect(page).to have_content("_partial.html.erb")
17
17
  end
18
18
  end
19
19
 
@@ -24,7 +24,7 @@ describe Admin::TopController do
24
24
  it '_partial_mobile_docomo.html.erbが使用されること' do
25
25
  visit '/admin/top/full_path'
26
26
 
27
- page.should have_content("_partial_mobile_docomo.html.erb")
27
+ expect(page).to have_content("_partial_mobile_docomo.html.erb")
28
28
  end
29
29
  end
30
30
  end
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe "jpmobile integration spec" do
3
+ describe "jpmobile integration spec", :type => :feature do
4
4
  include Jpmobile::Util
5
5
 
6
6
  before do
@@ -10,65 +10,65 @@ describe "jpmobile integration spec" do
10
10
  shared_examples_for "hankaku_filter :input => true のとき" do
11
11
  it "はtextareaの中では半角に変換されないこと" do
12
12
  visit "/#{controller}/textarea"
13
- page.body.encode('UTF-8').should have_content('アブラカダブラ')
13
+ expect(page.body.encode('UTF-8')).to have_content('アブラカダブラ')
14
14
  end
15
15
  it "はinputのvalueの中では半角に変換されないこと" do
16
16
  visit "/#{controller}/input_tag"
17
- page.body.encode('UTF-8').should have_css('input[value="アブラカダブラ"]')
17
+ expect(page.body.encode('UTF-8')).to have_css('input[value="アブラカダブラ"]')
18
18
  end
19
19
  it "は 変換されない" do
20
20
  visit "/#{controller}/nbsp_char"
21
- page.body.encode('UTF-8').should have_content('アブラ カダブラ')
21
+ expect(page.body.encode('UTF-8')).to have_content('アブラ カダブラ')
22
22
  end
23
23
  end
24
24
 
25
25
  shared_examples_for "hankaku_filter :input => false のとき" do
26
26
  it "はtextareaの中でも半角に変換されること" do
27
27
  visit "/#{controller}/textarea"
28
- page.body.encode('UTF-8').should have_content('アブラカダブラ')
28
+ expect(page.body.encode('UTF-8')).to have_content('アブラカダブラ')
29
29
  end
30
30
  it "はinputのvalueの中も半角に変換されること" do
31
31
  visit "/#{controller}/input_tag"
32
- page.body.encode('UTF-8').should have_css('input[value="アブラカダブラ"]')
32
+ expect(page.body.encode('UTF-8')).to have_css('input[value="アブラカダブラ"]')
33
33
  end
34
34
  it "は 変換されない" do
35
35
  visit "/#{controller}/nbsp_char"
36
- page.body.encode('UTF-8').should have_content('アブラ カダブラ')
36
+ expect(page.body.encode('UTF-8')).to have_content('アブラ カダブラ')
37
37
  end
38
38
  end
39
39
 
40
40
  shared_examples_for "文字コードフィルタが動作しているとき" do
41
41
  it "はhtml以外は変換しないこと" do
42
42
  visit "/#{controller}/rawdata"
43
- page.body.encode('UTF-8').should have_content("アブラカダブラ")
44
- page.response_headers['Content-Type'].should_not =~ /charset/i
43
+ expect(page.body.encode('UTF-8')).to have_content("アブラカダブラ")
44
+ expect(page.response_headers['Content-Type']).not_to match(/charset/i)
45
45
  end
46
46
  it "response.bodyが空のときは文字コードを変更しないこと" do
47
47
  visit "/#{controller}/empty"
48
- page.response_headers['Content-Type'].should =~ /utf-8/i
48
+ expect(page.response_headers['Content-Type']).to match(/utf-8/i)
49
49
  end
50
50
  end
51
51
 
52
52
  shared_examples_for "Shift_JISで通信する端末との通信" do
53
53
  it "はShift_JISで携帯に送出されること" do
54
54
  visit "/#{controller}/abracadabra_utf8"
55
- page.body.encode('UTF-8').should have_content("アブラカダブラ")
56
- page.response_headers['Content-Type'].should =~ /Shift_JIS/i
55
+ expect(page.body.encode('UTF-8')).to have_content("アブラカダブラ")
56
+ expect(page.response_headers['Content-Type']).to match(/Shift_JIS/i)
57
57
  end
58
58
  it "はxhtmlでもShift_JISで携帯に送出されること" do
59
59
  visit "/#{controller}/abracadabra_xhtml_utf8"
60
60
 
61
- page.body.encode('UTF-8').should have_content("アブラカダブラ")
62
- page.response_headers['Content-Type'].should =~ /Shift_JIS/i
61
+ expect(page.body.encode('UTF-8')).to have_content("アブラカダブラ")
62
+ expect(page.response_headers['Content-Type']).to match(/Shift_JIS/i)
63
63
  end
64
64
  it "はShift_JISで渡されたパラメタがparamsにUTF-8に変換されて格納されること" do
65
65
  visit "/#{controller}/index_zenkaku?q=#{URI.escape(utf8_to_sjis("アブラカダブラ"))}"
66
- page.body.encode('UTF-8').should have_content('true')
66
+ expect(page.body.encode('UTF-8')).to have_content('true')
67
67
  end
68
68
  it "は半角カナのparamsを変換しないこと" do
69
69
  # アブラカダブラ半角,SJIS
70
70
  visit "/#{controller}/index_hankaku?q=#{URI.escape(sjis("\261\314\336\327\266\300\336\314\336\327"))}"
71
- page.body.encode('UTF-8').should have_content('true')
71
+ expect(page.body.encode('UTF-8')).to have_content('true')
72
72
  end
73
73
  it_should_behave_like "文字コードフィルタが動作しているとき"
74
74
  end
@@ -76,21 +76,21 @@ describe "jpmobile integration spec" do
76
76
  shared_examples_for "UTF-8で通信する端末との通信" do
77
77
  it "はUTF-8で携帯に送出されること" do
78
78
  visit "/#{controller}/abracadabra_utf8"
79
- page.body.encode('UTF-8').should have_content("アブラカダブラ")
80
- page.response_headers['Content-Type'].should =~ /utf-8/i
79
+ expect(page.body.encode('UTF-8')).to have_content("アブラカダブラ")
80
+ expect(page.response_headers['Content-Type']).to match(/utf-8/i)
81
81
  end
82
82
  it "はxhtmlでもUTF-8で携帯に送出されること" do
83
83
  visit "/#{controller}/abracadabra_xhtml_utf8"
84
- page.body.encode('UTF-8').should have_content("アブラカダブラ")
85
- page.response_headers['Content-Type'].should =~ /utf-8/i
84
+ expect(page.body.encode('UTF-8')).to have_content("アブラカダブラ")
85
+ expect(page.response_headers['Content-Type']).to match(/utf-8/i)
86
86
  end
87
87
  it "はparamsにUTF-8のまま格納されること" do
88
88
  visit "/#{controller}/index_zenkaku?q=#{URI.escape("アブラカダブラ")}"
89
- page.body.encode('UTF-8').should have_content('true')
89
+ expect(page.body.encode('UTF-8')).to have_content('true')
90
90
  end
91
91
  it "は半角カナのparamsを変換しないこと" do
92
92
  visit "/#{controller}/index_hankaku?q=#{URI.escape("アブラカダブラ")}"
93
- page.body.encode('UTF-8').should have_content('true')
93
+ expect(page.body.encode('UTF-8')).to have_content('true')
94
94
  end
95
95
  it_should_behave_like "文字コードフィルタが動作しているとき"
96
96
  end
@@ -98,17 +98,17 @@ describe "jpmobile integration spec" do
98
98
  shared_examples_for "Shift_JISで通信する端末との通信(半角変換付き)" do
99
99
  it "は半角に変換されShift_JISで携帯に送出されること" do
100
100
  visit "/#{controller}/abracadabra_utf8"
101
- page.body.encode('UTF-8').should have_content("アブラカダブラ") # アブラカダブラ半角,SJIS
102
- page.response_headers['Content-Type'].should =~ /Shift_JIS/
101
+ expect(page.body.encode('UTF-8')).to have_content("アブラカダブラ") # アブラカダブラ半角,SJIS
102
+ expect(page.response_headers['Content-Type']).to match(/Shift_JIS/)
103
103
  end
104
104
  it "はShift_JISで渡されたパラメタがparamsにUTF-8に変換されて格納されること" do
105
105
  visit "/#{controller}/index_zenkaku?q=#{URI.escape(utf8_to_sjis("アブラカダブラ"))}"
106
- page.body.encode('UTF-8').should have_content('true')
106
+ expect(page.body.encode('UTF-8')).to have_content('true')
107
107
  end
108
108
  it "は半角Shift_JISで渡されたパラメタがparamsに全角UTF-8に変換されて格納されること" do
109
109
  # アブラカダブラ半角,SJIS
110
110
  visit "/#{controller}/index_zenkaku?q=#{URI.escape(sjis("\261\314\336\327\266\300\336\314\336\327"))}"
111
- page.body.encode('UTF-8').should have_content('true')
111
+ expect(page.body.encode('UTF-8')).to have_content('true')
112
112
  end
113
113
  it_should_behave_like "文字コードフィルタが動作しているとき"
114
114
  end
@@ -116,16 +116,16 @@ describe "jpmobile integration spec" do
116
116
  shared_examples_for "UTF-8で通信する端末との通信(半角変換付き)" do
117
117
  it "はUTF-8半角で携帯に送出されること" do
118
118
  visit "/#{controller}/abracadabra_utf8"
119
- page.body.encode('UTF-8').should have_content("アブラカダブラ")
120
- page.response_headers['Content-Type'].should =~ /utf-8/i
119
+ expect(page.body.encode('UTF-8')).to have_content("アブラカダブラ")
120
+ expect(page.response_headers['Content-Type']).to match(/utf-8/i)
121
121
  end
122
122
  it "はparamsにUTF-8のまま格納されること" do
123
123
  visit "/#{controller}/index_zenkaku?q=#{URI.escape("アブラカダブラ")}"
124
- page.body.encode('UTF-8').should have_content('true')
124
+ expect(page.body.encode('UTF-8')).to have_content('true')
125
125
  end
126
126
  it "は半角で渡されたparamsを全角に変換して格納すること" do
127
127
  visit "/#{controller}/index_zenkaku?q=#{URI.escape("アブラカダブラ")}"
128
- page.body.encode('UTF-8').should have_content('true')
128
+ expect(page.body.encode('UTF-8')).to have_content('true')
129
129
  end
130
130
  it_should_behave_like "文字コードフィルタが動作しているとき"
131
131
  end
@@ -214,7 +214,7 @@ describe "jpmobile integration spec" do
214
214
 
215
215
  it "Content-Type が Shift_JIS であること" do
216
216
  visit "/#{controller }/with_charset"
217
- body.should match(/Shift_JIS/)
217
+ expect(body).to match(/Shift_JIS/)
218
218
  end
219
219
  end
220
220
 
@@ -228,7 +228,7 @@ describe "jpmobile integration spec" do
228
228
 
229
229
  it "Content-Type が UTF-8 であること" do
230
230
  visit "/#{controller}/with_charset"
231
- page.response_headers['Content-Type'].should match(/UTF-8/i)
231
+ expect(page.response_headers['Content-Type']).to match(/UTF-8/i)
232
232
  end
233
233
  end
234
234
  end
@@ -1,13 +1,13 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe Jpmobile::Helpers do
3
+ describe Jpmobile::Helpers, :type => :helper do
4
4
  include Jpmobile::Helpers
5
5
  it "docomo_guid_link_to が guid=ON を付けたリンクを生成すること" do
6
- docomo_guid_link_to("STRING", :controller => "filter", :action => "rawdata").should == %{<a href="/filter/rawdata?guid=ON">STRING</a>}
6
+ expect(docomo_guid_link_to("STRING", :controller => "filter", :action => "rawdata")).to eq(%{<a href="/filter/rawdata?guid=ON">STRING</a>})
7
7
  end
8
8
 
9
9
  it "softbank_location_link_to がリンク先にパラメータを含んでいても正常に動作すること" do
10
10
  # http://d.hatena.ne.jp/mizincogrammer/20090123/1232702067
11
- softbank_location_link_to("STRING", :controller => "filter", :action => "rawdata", :p => "param").should == %{<a href="location:auto?url=http://test.host/filter/rawdata&amp;p=param">STRING</a>}
11
+ expect(softbank_location_link_to("STRING", :controller => "filter", :action => "rawdata", :p => "param")).to eq(%{<a href="location:auto?url=http://test.host/filter/rawdata&amp;p=param">STRING</a>})
12
12
  end
13
13
  end