jpmobile 5.0.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -3
  3. data/.rubocop.yml +123 -0
  4. data/CONTRIBUTING.md +16 -14
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +198 -0
  7. data/README.md +409 -0
  8. data/Rakefile +9 -9
  9. data/circle.yml +14 -0
  10. data/jpmobile.gemspec +9 -10
  11. data/lib/jpmobile.rb +6 -5
  12. data/lib/jpmobile/datum_conv.rb +35 -35
  13. data/lib/jpmobile/docomo_guid.rb +7 -8
  14. data/lib/jpmobile/email.rb +12 -12
  15. data/lib/jpmobile/emoticon.rb +85 -76
  16. data/lib/jpmobile/emoticon/au.rb +1284 -1284
  17. data/lib/jpmobile/emoticon/conversion_table.rb +3905 -3906
  18. data/lib/jpmobile/emoticon/docomo.rb +252 -252
  19. data/lib/jpmobile/emoticon/google.rb +9 -9
  20. data/lib/jpmobile/emoticon/softbank.rb +471 -471
  21. data/lib/jpmobile/emoticon/unicode.rb +9 -9
  22. data/lib/jpmobile/emoticon/z_combine.rb +20 -23
  23. data/lib/jpmobile/encoding.rb +1 -1
  24. data/lib/jpmobile/fallback_view_selector.rb +2 -3
  25. data/lib/jpmobile/filter.rb +44 -47
  26. data/lib/jpmobile/helpers.rb +38 -38
  27. data/lib/jpmobile/hook_action_view.rb +7 -7
  28. data/lib/jpmobile/hook_test_request.rb +0 -1
  29. data/lib/jpmobile/lookup_context.rb +1 -2
  30. data/lib/jpmobile/mail.rb +156 -134
  31. data/lib/jpmobile/mailer.rb +4 -4
  32. data/lib/jpmobile/mobile/abstract_mobile.rb +62 -36
  33. data/lib/jpmobile/mobile/android.rb +0 -1
  34. data/lib/jpmobile/mobile/android_tablet.rb +0 -1
  35. data/lib/jpmobile/mobile/au.rb +40 -28
  36. data/lib/jpmobile/mobile/black_berry.rb +0 -1
  37. data/lib/jpmobile/mobile/ddipocket.rb +1 -2
  38. data/lib/jpmobile/mobile/docomo.rb +47 -36
  39. data/lib/jpmobile/mobile/emobile.rb +1 -2
  40. data/lib/jpmobile/mobile/google_emoticon.rb +1 -1
  41. data/lib/jpmobile/mobile/ipad.rb +0 -1
  42. data/lib/jpmobile/mobile/iphone.rb +0 -1
  43. data/lib/jpmobile/mobile/smart_phone.rb +0 -1
  44. data/lib/jpmobile/mobile/softbank.rb +24 -20
  45. data/lib/jpmobile/mobile/tablet.rb +0 -1
  46. data/lib/jpmobile/mobile/unicode_emoticon.rb +15 -15
  47. data/lib/jpmobile/mobile/vodafone.rb +0 -1
  48. data/lib/jpmobile/mobile/willcom.rb +7 -7
  49. data/lib/jpmobile/mobile/windows_phone.rb +0 -1
  50. data/lib/jpmobile/path_set.rb +1 -1
  51. data/lib/jpmobile/position.rb +30 -14
  52. data/lib/jpmobile/rack/filter.rb +4 -4
  53. data/lib/jpmobile/rack/mobile_carrier.rb +0 -1
  54. data/lib/jpmobile/rack/params_filter.rb +7 -6
  55. data/lib/jpmobile/rails.rb +3 -4
  56. data/lib/jpmobile/request_with_mobile.rb +9 -6
  57. data/lib/jpmobile/resolver.rb +23 -17
  58. data/lib/jpmobile/session/active_record_store.rb +7 -9
  59. data/lib/jpmobile/session/mem_cache_store.rb +7 -9
  60. data/lib/jpmobile/sinatra.rb +1 -1
  61. data/lib/jpmobile/trans_sid.rb +15 -20
  62. data/lib/jpmobile/util.rb +61 -77
  63. data/lib/jpmobile/version.rb +1 -1
  64. data/lib/tasks/jpmobile_tasks.rake +35 -28
  65. data/spec/rack/jpmobile/android_spec.rb +5 -5
  66. data/spec/rack/jpmobile/au_spec.rb +74 -59
  67. data/spec/rack/jpmobile/black_berry_spec.rb +5 -5
  68. data/spec/rack/jpmobile/docomo_spec.rb +77 -64
  69. data/spec/rack/jpmobile/emoticon_spec.rb +137 -121
  70. data/spec/rack/jpmobile/filter_spec.rb +149 -128
  71. data/spec/rack/jpmobile/iphone_spec.rb +9 -8
  72. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +22 -21
  73. data/spec/rack/jpmobile/params_filter_spec.rb +104 -96
  74. data/spec/rack/jpmobile/softbank_spec.rb +49 -42
  75. data/spec/rack/jpmobile/willcom_spec.rb +22 -18
  76. data/spec/rack/jpmobile/windows_phone.rb +5 -5
  77. data/spec/rack_helper.rb +9 -8
  78. data/spec/spec_helper.rb +5 -6
  79. data/spec/unit/decorated_mail_spec.rb +8 -9
  80. data/spec/unit/email_spec.rb +44 -44
  81. data/spec/unit/emoticon_spec.rb +57 -58
  82. data/spec/unit/encoding_spec.rb +35 -36
  83. data/spec/unit/is_carrier_spec.rb +49 -49
  84. data/spec/unit/mail_spec.rb +153 -143
  85. data/spec/unit/mobile/iphone_spec.rb +6 -7
  86. data/spec/unit/receive_mail_spec.rb +172 -173
  87. data/spec/unit/spec_helper.rb +6 -6
  88. data/spec/unit/util_spec.rb +125 -46
  89. data/spec/unit/valid_ip_spec.rb +35 -35
  90. data/spec/unit/variants_spec.rb +18 -19
  91. data/test/rails/overrides/Gemfile +54 -0
  92. data/test/rails/overrides/Gemfile.jpmobile +1 -2
  93. data/test/rails/overrides/app/controllers/admin/top_controller.rb +1 -1
  94. data/test/rails/overrides/app/controllers/docomo_guid_base_controller.rb +1 -1
  95. data/test/rails/overrides/app/controllers/filter_controller_base.rb +14 -6
  96. data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +1 -1
  97. data/test/rails/overrides/app/controllers/mobile_spec_controller.rb +1 -1
  98. data/test/rails/overrides/app/controllers/template_path_controller.rb +1 -2
  99. data/test/rails/overrides/app/controllers/trans_sid_base_controller.rb +18 -10
  100. data/test/rails/overrides/app/controllers/trans_sid_metal_controller.rb +0 -1
  101. data/test/rails/overrides/app/mailers/decorated_mailer.rb +3 -4
  102. data/test/rails/overrides/app/mailers/mobile_mailer.rb +5 -6
  103. data/test/rails/overrides/app/mailers/normal_mailer.rb +2 -3
  104. data/test/rails/overrides/autotest/discover.rb +2 -2
  105. data/test/rails/overrides/config/initializers/jpmobile_generator.rb +2 -2
  106. data/test/rails/overrides/config/routes.rb +95 -2
  107. data/test/rails/overrides/db/migrate/001_add_sessions_table.rb +2 -2
  108. data/test/rails/overrides/db/migrate/20100824062306_create_users.rb +1 -1
  109. data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +24 -25
  110. data/test/rails/overrides/spec/controllers/helpers_spec.rb +88 -88
  111. data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +9 -9
  112. data/test/rails/overrides/spec/controllers/template_path_spec.rb +19 -19
  113. data/test/rails/overrides/spec/features/admin/top_spec.rb +7 -7
  114. data/test/rails/overrides/spec/features/filter_spec.rb +101 -102
  115. data/test/rails/overrides/spec/helpers/helpers_spec.rb +4 -4
  116. data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +12 -12
  117. data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +209 -194
  118. data/test/rails/overrides/spec/mailers/normal_mailer_spec.rb +10 -10
  119. data/test/rails/overrides/spec/rails_helper.rb +1 -1
  120. data/test/rails/overrides/spec/requests/docomo_spec.rb +13 -13
  121. data/test/rails/overrides/spec/requests/emobile_spec.rb +19 -19
  122. data/test/rails/overrides/spec/requests/pc_spec.rb +6 -6
  123. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +6 -6
  124. data/test/rails/overrides/spec/requests/template_path_spec.rb +60 -60
  125. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +89 -89
  126. data/test/sinatra/test/filter_test.rb +10 -11
  127. data/tools/e4u_conv.rb +0 -1
  128. metadata +18 -14
  129. data/README +0 -0
  130. data/README.rdoc +0 -308
@@ -1,101 +1,100 @@
1
- # -*- coding: utf-8 -*-
2
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
3
2
 
4
- describe "Jpmobile::Mobile" do
3
+ describe 'Jpmobile::Mobile' do
5
4
  include Jpmobile::Util
6
5
 
7
- describe "AbstractMobile" do
6
+ describe 'AbstractMobile' do
8
7
  before(:each) do
9
8
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
10
9
  end
11
10
 
12
- context "to_mail_subject" do
13
- it "should convert string to ISO-2022-JP B-Encoding when string contains Japanese" do
14
- expect(@mobile.to_mail_subject("ほげ")).to eq("=?ISO-2022-JP?B?GyRCJFskMhsoQg==?=")
11
+ context 'to_mail_subject' do
12
+ it 'should convert string to ISO-2022-JP B-Encoding when string contains Japanese' do
13
+ expect(@mobile.to_mail_subject('ほげ')).to eq('=?ISO-2022-JP?B?GyRCJFskMhsoQg==?=')
15
14
  end
16
15
  end
17
16
 
18
- context "to_mail_body" do
19
- it "should convert string to ISO-2022-JP when string contains Japanese" do
20
- expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_jis("ほげ"))
17
+ context 'to_mail_body' do
18
+ it 'should convert string to ISO-2022-JP when string contains Japanese' do
19
+ expect(@mobile.to_mail_body('ほげ')).to eq(utf8_to_jis('ほげ'))
21
20
  end
22
21
  end
23
22
  end
24
23
 
25
- describe "Docomo" do
24
+ describe 'Docomo' do
26
25
  before(:each) do
27
26
  @mobile = Jpmobile::Mobile::Docomo.new(nil, nil)
28
27
  end
29
28
 
30
- context "to_mail_subject" do
31
- it "should convert string to Shift_JIS B-Encoding when string contains Japanese" do
32
- expect(@mobile.to_mail_subject("ほげ")).to eq("=?Shift_JIS?B?gtmCsA==?=")
29
+ context 'to_mail_subject' do
30
+ it 'should convert string to Shift_JIS B-Encoding when string contains Japanese' do
31
+ expect(@mobile.to_mail_subject('ほげ')).to eq('=?Shift_JIS?B?gtmCsA==?=')
33
32
  end
34
33
 
35
34
  it "should convert emoticon  to \xf8\x9f in B-Encoding" do
36
- expect(@mobile.to_mail_subject("ほげ")).to eq("=?Shift_JIS?B?gtmCsPif?=")
35
+ expect(@mobile.to_mail_subject('ほげ')).to eq('=?Shift_JIS?B?gtmCsPif?=')
37
36
  end
38
37
  end
39
38
 
40
- context "to_mail_body" do
41
- it "should convert string to Shift_JIS when string contains Japanese" do
42
- expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_sjis("ほげ"))
39
+ context 'to_mail_body' do
40
+ it 'should convert string to Shift_JIS when string contains Japanese' do
41
+ expect(@mobile.to_mail_body('ほげ')).to eq(utf8_to_sjis('ほげ'))
43
42
  end
44
43
 
45
44
  it "should convert emoticon  to \xf8\x9f" do
46
- expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_sjis("ほげ") + sjis("\xf8\x9f"))
45
+ expect(@mobile.to_mail_body('ほげ')).to eq(utf8_to_sjis('ほげ') + sjis("\xf8\x9f"))
47
46
  end
48
47
  end
49
48
  end
50
49
 
51
- describe "Au" do
50
+ describe 'Au' do
52
51
  before(:each) do
53
52
  @mobile = Jpmobile::Mobile::Au.new(nil, nil)
54
53
  end
55
54
 
56
- context "to_mail_subject" do
57
- it "should convert string to ISO-2022-JP B-Encoding when string contains Japanese" do
58
- expect(@mobile.to_mail_subject("ほげ")).to eq("=?ISO-2022-JP?B?GyRCJFskMhsoQg==?=")
55
+ context 'to_mail_subject' do
56
+ it 'should convert string to ISO-2022-JP B-Encoding when string contains Japanese' do
57
+ expect(@mobile.to_mail_subject('ほげ')).to eq('=?ISO-2022-JP?B?GyRCJFskMhsoQg==?=')
59
58
  end
60
59
 
61
60
  it "should convert emoticon  to \x75\x41 in B-Encoding" do
62
- expect(@mobile.to_mail_subject("ほげ")).to eq("=?ISO-2022-JP?B?GyRCJFskMnVBGyhC?=")
61
+ expect(@mobile.to_mail_subject('ほげ')).to eq('=?ISO-2022-JP?B?GyRCJFskMnVBGyhC?=')
63
62
  end
64
63
  end
65
64
 
66
- context "to_mail_body" do
67
- it "should convert string to ISO-2022-JP when string contains Japanese" do
68
- expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_jis("ほげ"))
65
+ context 'to_mail_body' do
66
+ it 'should convert string to ISO-2022-JP when string contains Japanese' do
67
+ expect(@mobile.to_mail_body('ほげ')).to eq(utf8_to_jis('ほげ'))
69
68
  end
70
69
 
71
70
  it "should convert emoticon  to \x75\x41" do
72
- expect(ascii_8bit(@mobile.to_mail_body("ほげ"))).to eq(ascii_8bit(jis("\e\x24\x42\x24\x5B\x24\x32\x75\x41\x1b\x28\x42")))
71
+ expect(ascii_8bit(@mobile.to_mail_body('ほげ'))).to eq(ascii_8bit(jis("\e\x24\x42\x24\x5B\x24\x32\x75\x41\x1b\x28\x42")))
73
72
  end
74
73
  end
75
74
  end
76
75
 
77
- describe "Softbank" do
76
+ describe 'Softbank' do
78
77
  before(:each) do
79
78
  @mobile = Jpmobile::Mobile::Softbank.new(nil, nil)
80
79
  end
81
80
 
82
- context "to_mail_subject" do
83
- it "should convert string to Shift_JIS B-Encoding when string contains Japanese" do
84
- expect(@mobile.to_mail_subject("ほげ")).to eq("=?Shift_JIS?B?gtmCsA==?=")
81
+ context 'to_mail_subject' do
82
+ it 'should convert string to Shift_JIS B-Encoding when string contains Japanese' do
83
+ expect(@mobile.to_mail_subject('ほげ')).to eq('=?Shift_JIS?B?gtmCsA==?=')
85
84
  end
86
85
 
87
86
  it "should convert emoticon  to \xf9\x8b in B-Encoding" do
88
- expect(@mobile.to_mail_subject("ほげ")).to eq("=?Shift_JIS?B?gtmCsPmL?=")
87
+ expect(@mobile.to_mail_subject('ほげ')).to eq('=?Shift_JIS?B?gtmCsPmL?=')
89
88
  end
90
89
  end
91
90
 
92
- context "to_mail_body" do
93
- it "should convert string to Shift_JIS when string contains Japanese" do
94
- expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_sjis("ほげ"))
91
+ context 'to_mail_body' do
92
+ it 'should convert string to Shift_JIS when string contains Japanese' do
93
+ expect(@mobile.to_mail_body('ほげ')).to eq(utf8_to_sjis('ほげ'))
95
94
  end
96
95
 
97
96
  it "should convert emoticon  to \xf9\x8b" do
98
- expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_sjis("ほげ") + sjis("\xf9\x8b"))
97
+ expect(@mobile.to_mail_body('ほげ')).to eq(utf8_to_sjis('ほげ') + sjis("\xf9\x8b"))
99
98
  end
100
99
  end
101
100
  end
@@ -2,61 +2,61 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
2
 
3
3
  describe 'Jpmobile::Mobile' do
4
4
  [
5
- [ %w[ Docomo docomo ] , true ],
6
- [ %w[ Docomo au ] , false ],
7
- [ %w[ Docomo softbank ] , false ],
8
- [ %w[ Docomo vodafone ] , false ],
9
- [ %w[ Docomo emobile ] , false ],
10
- [ %w[ Docomo willcom ] , false ],
11
- [ %w[ Docomo ddipocket ] , false ],
5
+ [%w[Docomo docomo], true],
6
+ [%w[Docomo au], false],
7
+ [%w[Docomo softbank], false],
8
+ [%w[Docomo vodafone], false],
9
+ [%w[Docomo emobile], false],
10
+ [%w[Docomo willcom], false],
11
+ [%w[Docomo ddipocket], false],
12
12
 
13
- [ %w[ Au docomo ] , false ],
14
- [ %w[ Au au ] , true ],
15
- [ %w[ Au softbank ] , false ],
16
- [ %w[ Au vodafone ] , false ],
17
- [ %w[ Au emobile ] , false ],
18
- [ %w[ Au willcom ] , false ],
19
- [ %w[ Au ddipocket ] , false ],
13
+ [%w[Au docomo], false],
14
+ [%w[Au au], true],
15
+ [%w[Au softbank], false],
16
+ [%w[Au vodafone], false],
17
+ [%w[Au emobile], false],
18
+ [%w[Au willcom], false],
19
+ [%w[Au ddipocket], false],
20
20
 
21
- [ %w[ Softbank docomo ] , false ],
22
- [ %w[ Softbank au ] , false ],
23
- [ %w[ Softbank softbank ] , true ],
24
- [ %w[ Softbank vodafone ] , false ],
25
- [ %w[ Softbank emobile ] , false ],
26
- [ %w[ Softbank willcom ] , false ],
27
- [ %w[ Softbank ddipocket ] , false ],
21
+ [%w[Softbank docomo], false],
22
+ [%w[Softbank au], false],
23
+ [%w[Softbank softbank], true],
24
+ [%w[Softbank vodafone], false],
25
+ [%w[Softbank emobile], false],
26
+ [%w[Softbank willcom], false],
27
+ [%w[Softbank ddipocket], false],
28
28
 
29
- [ %w[ Vodafone docomo ] , false ],
30
- [ %w[ Vodafone au ] , false ],
31
- [ %w[ Vodafone softbank ] , true ],
32
- [ %w[ Vodafone vodafone ] , true ],
33
- [ %w[ Vodafone emobile ] , false ],
34
- [ %w[ Vodafone willcom ] , false ],
35
- [ %w[ Vodafone ddipocket ] , false ],
29
+ [%w[Vodafone docomo], false],
30
+ [%w[Vodafone au], false],
31
+ [%w[Vodafone softbank], true],
32
+ [%w[Vodafone vodafone], true],
33
+ [%w[Vodafone emobile], false],
34
+ [%w[Vodafone willcom], false],
35
+ [%w[Vodafone ddipocket], false],
36
36
 
37
- [ %w[ Emobile docomo ] , false ],
38
- [ %w[ Emobile au ] , false ],
39
- [ %w[ Emobile softbank ] , false ],
40
- [ %w[ Emobile vodafone ] , false ],
41
- [ %w[ Emobile emobile ] , true ],
42
- [ %w[ Emobile willcom ] , false ],
43
- [ %w[ Emobile ddipocket ] , false ],
37
+ [%w[Emobile docomo], false],
38
+ [%w[Emobile au], false],
39
+ [%w[Emobile softbank], false],
40
+ [%w[Emobile vodafone], false],
41
+ [%w[Emobile emobile], true],
42
+ [%w[Emobile willcom], false],
43
+ [%w[Emobile ddipocket], false],
44
44
 
45
- [ %w[ Willcom docomo ] , false ],
46
- [ %w[ Willcom au ] , false ],
47
- [ %w[ Willcom softbank ] , false ],
48
- [ %w[ Willcom vodafone ] , false ],
49
- [ %w[ Willcom emobile ] , false ],
50
- [ %w[ Willcom willcom ] , true ],
51
- [ %w[ Willcom ddipocket ] , false ],
45
+ [%w[Willcom docomo], false],
46
+ [%w[Willcom au], false],
47
+ [%w[Willcom softbank], false],
48
+ [%w[Willcom vodafone], false],
49
+ [%w[Willcom emobile], false],
50
+ [%w[Willcom willcom], true],
51
+ [%w[Willcom ddipocket], false],
52
52
 
53
- [ %w[ Ddipocket docomo ] , false ],
54
- [ %w[ Ddipocket au ] , false ],
55
- [ %w[ Ddipocket softbank ] , false ],
56
- [ %w[ Ddipocket vodafone ] , false ],
57
- [ %w[ Ddipocket emobile ] , false ],
58
- [ %w[ Ddipocket willcom ] , true ],
59
- [ %w[ Ddipocket ddipocket ] , true ],
53
+ [%w[Ddipocket docomo], false],
54
+ [%w[Ddipocket au], false],
55
+ [%w[Ddipocket softbank], false],
56
+ [%w[Ddipocket vodafone], false],
57
+ [%w[Ddipocket emobile], false],
58
+ [%w[Ddipocket willcom], true],
59
+ [%w[Ddipocket ddipocket], true],
60
60
  ].each do |carrier, expected|
61
61
  it "#{carrier.first}##{carrier.last}? should be return #{expected}" do
62
62
  expect(Jpmobile::Mobile.const_get(carrier.first).new({}, {}).__send__("#{carrier.last}?")).to eq(expected)
@@ -1,294 +1,294 @@
1
- # -*- coding: utf-8 -*-
2
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
3
2
  require 'mail'
4
3
  require 'jpmobile/mail'
5
4
 
6
- describe "Jpmobile::Mail" do
5
+ describe 'Jpmobile::Mail' do
7
6
  include Jpmobile::Util
8
7
 
9
8
  before(:each) do
10
9
  @mail = Mail.new
11
- @mail.subject = "万葉"
12
- @mail.body = "ほげ"
13
- @mail.from = "ちはやふる <info@jpmobile-rails.org>"
10
+ @mail.subject = '万葉'
11
+ @mail.body = 'ほげ'
12
+ @mail.from = 'ちはやふる <info@jpmobile-rails.org>'
14
13
  end
15
14
 
16
- context "Mail#to" do
17
- it "sets multi-tos" do
18
- expect{@mail.to = ["a@hoge.com", "b@hoge.com"]}.to_not raise_error
15
+ context 'Mail#to' do
16
+ it 'sets multi-tos' do
17
+ expect { @mail.to = ['a@hoge.com', 'b@hoge.com'] }.to_not raise_error
19
18
  end
20
19
  end
21
20
 
22
- describe "Non-mobile" do
21
+ describe 'Non-mobile' do
23
22
  before(:each) do
24
23
  @mail = Mail.new do
25
- subject "万葉"
26
- from "ちはやふる <info@jpmobile-rails.org>"
24
+ subject '万葉'
25
+ from 'ちはやふる <info@jpmobile-rails.org>'
27
26
  end
28
27
  end
29
- context "has multipart body" do
28
+ context 'has multipart body' do
30
29
  before(:each) do
31
- @mail.parts << Mail::Part.new { body "ほげ" }
32
- @mail.parts << Mail::Part.new { body "ほげほげ" }
33
- @mail.parts.each{|p| p.charset = "ISO-2022-JP" }
30
+ @mail.parts << Mail::Part.new { body 'ほげ' }
31
+ @mail.parts << Mail::Part.new { body 'ほげほげ' }
32
+ @mail.parts.each { |p| p.charset = 'ISO-2022-JP' }
34
33
  end
35
- context "to_s" do
36
- subject {
34
+ context 'to_s' do
35
+ subject do
37
36
  Mail.new ascii_8bit(@mail.to_s)
38
- }
39
- it "should be able to decode bodies" do
40
- subject.parts[0].body == "ほげ"
41
- subject.parts[1].body == "ほげほげ"
37
+ end
38
+
39
+ it 'should be able to decode bodies' do
40
+ expect(subject.parts[0].body.to_s).to eq(ascii_8bit('ほげ'))
41
+ expect(subject.parts[1].body.to_s).to eq(ascii_8bit('ほげほげ'))
42
42
  end
43
43
  end
44
44
  end
45
45
  end
46
46
 
47
- describe "AbstractMobile" do
47
+ describe 'AbstractMobile' do
48
48
  before(:each) do
49
49
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
50
50
  @mail.mobile = @mobile
51
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
51
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
52
52
  end
53
53
 
54
- context "to_s" do
55
- it "should contain encoded subject" do
56
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQg==?=")))
54
+ context 'to_s' do
55
+ it 'should contain encoded subject' do
56
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCS3xNVRsoQg==?=')))
57
57
  end
58
58
 
59
- it "should contain encoded body" do
59
+ it 'should contain encoded body' do
60
60
  expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x24\x5B\x24\x32\e\x28\x42"))))
61
61
  end
62
62
 
63
- it "should contain encoded from"do
64
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("=?ISO-2022-JP?B?GyRCJEEkTyRkJFUkaxsoQg==?="))))
63
+ it 'should contain encoded from' do
64
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit('=?ISO-2022-JP?B?GyRCJEEkTyRkJFUkaxsoQg==?='))))
65
65
  end
66
66
 
67
- it "should contain encoded to" do
68
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("=?ISO-2022-JP?B?GyRCJGAkOSRhJFUkNSRbJDsbKEI=?="))))
67
+ it 'should contain encoded to' do
68
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit('=?ISO-2022-JP?B?GyRCJGAkOSRhJFUkNSRbJDsbKEI=?='))))
69
69
  end
70
70
 
71
- it "should contain correct Content-Type:" do
72
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("charset=ISO-2022-JP"))))
71
+ it 'should contain correct Content-Type:' do
72
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit('charset=ISO-2022-JP'))))
73
73
  end
74
74
  end
75
75
  end
76
76
 
77
- describe "Docomo" do
77
+ describe 'Docomo' do
78
78
  before(:each) do
79
79
  @mobile = Jpmobile::Mobile::Docomo.new(nil, nil)
80
80
  @mail.mobile = @mobile
81
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
81
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
82
82
  end
83
83
 
84
- context "to_s" do
85
- it "should contain encoded subject" do
86
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?lpyXdA==?="))
84
+ context 'to_s' do
85
+ it 'should contain encoded subject' do
86
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?lpyXdA==?='))
87
87
  end
88
88
 
89
- it "should contain encoded body" do
90
- expect(@mail.to_s).to match(Regexp.escape(utf8_to_sjis("ほげ")))
89
+ it 'should contain encoded body' do
90
+ expect(@mail.to_s).to match(Regexp.escape(utf8_to_sjis('ほげ')))
91
91
  end
92
92
 
93
- it "should contain encoded from" do
94
- expect(@mail.to_s).to match(sjis_regexp("gr+CzYLigtOC6Q=="))
93
+ it 'should contain encoded from' do
94
+ expect(@mail.to_s).to match(sjis_regexp('gr+CzYLigtOC6Q=='))
95
95
  end
96
96
 
97
- it "should contain encoded to" do
98
- expect(@mail.to_s).to match(sjis_regexp("gt6Ct4LfgtOCs4LZgrk="))
97
+ it 'should contain encoded to' do
98
+ expect(@mail.to_s).to match(sjis_regexp('gt6Ct4LfgtOCs4LZgrk='))
99
99
  end
100
100
 
101
- it "should contains encoded emoticon" do
102
- @mail.subject += "&#xe63e;"
101
+ it 'should contains encoded emoticon' do
102
+ @mail.subject += '&#xe63e;'
103
103
  @mail.body = "#{@mail.body}&#xe63e;"
104
104
 
105
- expect(@mail.to_s).to match(Regexp.escape("=?Shift_JIS?B?lpyXdPif?="))
105
+ expect(@mail.to_s).to match(Regexp.escape('=?Shift_JIS?B?lpyXdPif?='))
106
106
  expect(@mail.to_s).to match(sjis_regexp("\xF8\x9F"))
107
107
  end
108
108
  end
109
109
  end
110
110
 
111
- describe "Au" do
111
+ describe 'Au' do
112
112
  before(:each) do
113
113
  @mobile = Jpmobile::Mobile::Au.new(nil, nil)
114
114
  @mail.mobile = @mobile
115
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
115
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
116
116
  end
117
117
 
118
- context "to_s" do
119
- it "should contain encoded subject" do
120
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQg==?=")))
118
+ context 'to_s' do
119
+ it 'should contain encoded subject' do
120
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCS3xNVRsoQg==?=')))
121
121
  end
122
122
 
123
- it "should contain encoded body" do
123
+ it 'should contain encoded body' do
124
124
  expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x24\x5B\x24\x32\e\x28\x42"))))
125
125
  end
126
126
 
127
- it "should contain encoded from" do
128
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("=?ISO-2022-JP?B?GyRCJEEkTyRkJFUkaxsoQg==?="))))
127
+ it 'should contain encoded from' do
128
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit('=?ISO-2022-JP?B?GyRCJEEkTyRkJFUkaxsoQg==?='))))
129
129
  end
130
130
 
131
- it "should contain encoded to" do
132
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("=?ISO-2022-JP?B?GyRCJGAkOSRhJFUkNSRbJDsbKEI=?="))))
131
+ it 'should contain encoded to' do
132
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit('=?ISO-2022-JP?B?GyRCJGAkOSRhJFUkNSRbJDsbKEI=?='))))
133
133
  end
134
134
 
135
- it "should contain encoded emoticon" do
136
- @mail.subject += "&#xe63e;"
135
+ it 'should contain encoded emoticon' do
136
+ @mail.subject += '&#xe63e;'
137
137
  @mail.body = "#{@mail.body}&#xe63e;"
138
138
 
139
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVXVBGyhC?=")))
139
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCS3xNVXVBGyhC?=')))
140
140
  expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("\e\x24\x42\x24\x5B\x24\x32\x75\x41\e\x28\x42"))))
141
141
  end
142
142
  end
143
143
  end
144
144
 
145
- describe "Softbank" do
145
+ describe 'Softbank' do
146
146
  before(:each) do
147
147
  @mobile = Jpmobile::Mobile::Softbank.new(nil, nil)
148
148
  @mail.mobile = @mobile
149
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
149
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
150
150
  end
151
151
 
152
- context "to_s" do
153
- it "should contain encoded subject" do
154
- expect(@mail.to_s).to match(Regexp.escape(sjis("=?Shift_JIS?B?lpyXdA==?=")))
152
+ context 'to_s' do
153
+ it 'should contain encoded subject' do
154
+ expect(@mail.to_s).to match(Regexp.escape(sjis('=?Shift_JIS?B?lpyXdA==?=')))
155
155
  end
156
156
 
157
- it "should contain encoded body" do
158
- expect(@mail.to_s).to match(Regexp.escape(utf8_to_sjis("ほげ")))
157
+ it 'should contain encoded body' do
158
+ expect(@mail.to_s).to match(Regexp.escape(utf8_to_sjis('ほげ')))
159
159
  end
160
160
 
161
- it "should contain encoded from" do
162
- expect(@mail.to_s).to match(sjis_regexp("gr+CzYLigtOC6Q=="))
161
+ it 'should contain encoded from' do
162
+ expect(@mail.to_s).to match(sjis_regexp('gr+CzYLigtOC6Q=='))
163
163
  end
164
164
 
165
- it "should contain encoded to" do
166
- expect(@mail.to_s).to match(sjis_regexp("gt6Ct4LfgtOCs4LZgrk="))
165
+ it 'should contain encoded to' do
166
+ expect(@mail.to_s).to match(sjis_regexp('gt6Ct4LfgtOCs4LZgrk='))
167
167
  end
168
168
 
169
- it "should contains encoded emoticon" do
170
- @mail.subject += "&#xe63e;"
169
+ it 'should contains encoded emoticon' do
170
+ @mail.subject += '&#xe63e;'
171
171
  @mail.body = "#{@mail.body}&#xe63e;"
172
172
 
173
- expect(@mail.to_s).to match(Regexp.escape("=?Shift_JIS?B?lpyXdPmL?="))
173
+ expect(@mail.to_s).to match(Regexp.escape('=?Shift_JIS?B?lpyXdPmL?='))
174
174
  expect(@mail.to_s).to match(sjis_regexp("\xf9\x8b"))
175
175
  end
176
176
  end
177
177
  end
178
178
 
179
- describe "long subject" do
179
+ describe 'long subject' do
180
180
  before(:each) do
181
181
  @mail = Mail.new
182
- @mail.subject = "弊社採用応募へのお申込み誠にありがとうございますと言いたいところだがそうは簡単には物事は運ばないことを心しておいてもらいたいと苦言を呈する故に弊社は維持しているのです"
183
- @mail.body = "株式会社・・"
184
- @mail.from = "info@jpmobile-rails.org"
182
+ @mail.subject = '弊社採用応募へのお申込み誠にありがとうございますと言いたいところだがそうは簡単には物事は運ばないことを心しておいてもらいたいと苦言を呈する故に弊社は維持しているのです'
183
+ @mail.body = '株式会社・・'
184
+ @mail.from = 'info@jpmobile-rails.org'
185
185
  end
186
186
 
187
- describe "Docomo" do
187
+ describe 'Docomo' do
188
188
  before(:each) do
189
189
  @mobile = Jpmobile::Mobile::Docomo.new(nil, nil)
190
190
  @mail.mobile = @mobile
191
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
191
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
192
192
  end
193
193
 
194
- it "should contain encoded subject" do
195
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?lb6O0I3Ml3CJnpXlgtaCzIKokFyNnoLdkL2CyYKg?="))
196
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?guiCqoLGgqSCsoK0gqKC3IK3gsaMvoKigr2CooLG?="))
197
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?grGC64K+gqqCu4Kkgs2KyJJQgsmCzZWojpaCzYle?="))
198
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?gs6CyIKigrGCxoLwkFOCtYLEgqiCooLEguCC54Ki?="))
199
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?gr2CooLGi+qMvoLwkuaCt4LpjMyCyZW+jtCCzYjb?="))
200
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?jp2CtYLEgqKC6YLMgsWCtw==?="))
194
+ it 'should contain encoded subject' do
195
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?lb6O0I3Ml3CJnpXlgtaCzIKokFyNnoLdkL2CyYKg?='))
196
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?guiCqoLGgqSCsoK0gqKC3IK3gsaMvoKigr2CooLG?='))
197
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?grGC64K+gqqCu4Kkgs2KyJJQgsmCzZWojpaCzYle?='))
198
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?gs6CyIKigrGCxoLwkFOCtYLEgqiCooLEguCC54Ki?='))
199
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?gr2CooLGi+qMvoLwkuaCt4LpjMyCyZW+jtCCzYjb?='))
200
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?jp2CtYLEgqKC6YLMgsWCtw==?='))
201
201
  end
202
202
  end
203
203
 
204
- describe "Au" do
204
+ describe 'Au' do
205
205
  before(:each) do
206
206
  @mobile = Jpmobile::Mobile::Au.new(nil, nil)
207
207
  @mail.mobile = @mobile
208
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
208
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
209
209
  end
210
210
 
211
- it "should contain encoded subject" do
212
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCSkA8UjpOTVExfkpnJFgkTiQqPz05fiRfQD8kSyQiGyhC?=")))
213
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJGokLCRIJCYkNCQ2JCQkXiQ5JEg4QCQkJD8kJCRIGyhC?=")))
214
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJDMkbSRAJCwkPSQmJE80SkMxJEskT0oqO3YkTzE/GyhC?=")))
215
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJFAkSiQkJDMkSCRyPzQkNyRGJCokJCRGJGIkaSQkGyhC?=")))
216
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJD8kJCRINmw4QCRyRGgkOSRrOE4kS0pAPFIkTzBdGyhC?=")))
217
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCO30kNyRGJCQkayROJEckORsoQg==?=")))
211
+ it 'should contain encoded subject' do
212
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCSkA8UjpOTVExfkpnJFgkTiQqPz05fiRfQD8kSyQiGyhC?=')))
213
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCJGokLCRIJCYkNCQ2JCQkXiQ5JEg4QCQkJD8kJCRIGyhC?=')))
214
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCJDMkbSRAJCwkPSQmJE80SkMxJEskT0oqO3YkTzE/GyhC?=')))
215
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCJFAkSiQkJDMkSCRyPzQkNyRGJCokJCRGJGIkaSQkGyhC?=')))
216
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCJD8kJCRINmw4QCRyRGgkOSRrOE4kS0pAPFIkTzBdGyhC?=')))
217
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCO30kNyRGJCQkayROJEckORsoQg==?=')))
218
218
  end
219
219
  end
220
220
 
221
- describe "Softbank" do
221
+ describe 'Softbank' do
222
222
  before(:each) do
223
223
  @mobile = Jpmobile::Mobile::Softbank.new(nil, nil)
224
224
  @mail.mobile = @mobile
225
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
225
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
226
226
  end
227
227
 
228
- it "should contain encoded subject" do
229
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?lb6O0I3Ml3CJnpXlgtaCzIKokFyNnoLdkL2CyYKg?="))
230
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?guiCqoLGgqSCsoK0gqKC3IK3gsaMvoKigr2CooLG?="))
231
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?grGC64K+gqqCu4Kkgs2KyJJQgsmCzZWojpaCzYle?="))
232
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?gs6CyIKigrGCxoLwkFOCtYLEgqiCooLEguCC54Ki?="))
233
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?gr2CooLGi+qMvoLwkuaCt4LpjMyCyZW+jtCCzYjb?="))
234
- expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?jp2CtYLEgqKC6YLMgsWCtw==?="))
228
+ it 'should contain encoded subject' do
229
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?lb6O0I3Ml3CJnpXlgtaCzIKokFyNnoLdkL2CyYKg?='))
230
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?guiCqoLGgqSCsoK0gqKC3IK3gsaMvoKigr2CooLG?='))
231
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?grGC64K+gqqCu4Kkgs2KyJJQgsmCzZWojpaCzYle?='))
232
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?gs6CyIKigrGCxoLwkFOCtYLEgqiCooLEguCC54Ki?='))
233
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?gr2CooLGi+qMvoLwkuaCt4LpjMyCyZW+jtCCzYjb?='))
234
+ expect(@mail.to_s).to match(sjis_regexp('=?Shift_JIS?B?jp2CtYLEgqKC6YLMgsWCtw==?='))
235
235
  end
236
236
  end
237
237
 
238
- describe "AbstractMobile" do
238
+ describe 'AbstractMobile' do
239
239
  before(:each) do
240
240
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
241
241
  @mail.mobile = @mobile
242
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
242
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
243
243
  end
244
244
 
245
- context "to_s" do
246
- it "should contain encoded subject" do
247
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCSkA8UjpOTVExfkpnJFgkTiQqPz05fiRfQD8kSyQiGyhC?=")))
248
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJGokLCRIJCYkNCQ2JCQkXiQ5JEg4QCQkJD8kJCRIGyhC?=")))
249
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJDMkbSRAJCwkPSQmJE80SkMxJEskT0oqO3YkTzE/GyhC?=")))
250
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJFAkSiQkJDMkSCRyPzQkNyRGJCokJCRGJGIkaSQkGyhC?=")))
251
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCJD8kJCRINmw4QCRyRGgkOSRrOE4kS0pAPFIkTzBdGyhC?=")))
252
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCO30kNyRGJCQkayROJEckORsoQg==?=")))
245
+ context 'to_s' do
246
+ it 'should contain encoded subject' do
247
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCSkA8UjpOTVExfkpnJFgkTiQqPz05fiRfQD8kSyQiGyhC?=')))
248
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCJGokLCRIJCYkNCQ2JCQkXiQ5JEg4QCQkJD8kJCRIGyhC?=')))
249
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCJDMkbSRAJCwkPSQmJE80SkMxJEskT0oqO3YkTzE/GyhC?=')))
250
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCJFAkSiQkJDMkSCRyPzQkNyRGJCokJCRGJGIkaSQkGyhC?=')))
251
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCJD8kJCRINmw4QCRyRGgkOSRrOE4kS0pAPFIkTzBdGyhC?=')))
252
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCO30kNyRGJCQkayROJEckORsoQg==?=')))
253
253
  end
254
254
  end
255
255
  end
256
256
  end
257
257
 
258
- describe "long subject with half-characters" do
258
+ describe 'long subject with half-characters' do
259
259
  before(:each) do
260
260
  @mail = Mail.new
261
- @mail.subject = "西暦2012年09月03日は今日になるわけだが10時16分現在のこの時間ではどうかな"
262
- @mail.body = "株式会社・・"
263
- @mail.from = "info@jpmobile-rails.org"
261
+ @mail.subject = '西暦2012年09月03日は今日になるわけだが10時16分現在のこの時間ではどうかな'
262
+ @mail.body = '株式会社・・'
263
+ @mail.from = 'info@jpmobile-rails.org'
264
264
  end
265
265
 
266
- describe "AbstractMobile" do
266
+ describe 'AbstractMobile' do
267
267
  before(:each) do
268
268
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
269
269
  @mail.mobile = @mobile
270
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
270
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
271
271
  end
272
272
 
273
- context "to_s" do
274
- it "should contain encoded subject" do
275
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCQD5OcRsoQjIwMTIbJEJHLxsoQjA5GyRCN24bKEIwMxskQkZ8JE86IxsoQg==?=")))
276
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCRnwkSyRKJGskbyQxJEAkLBsoQjEwGyRCO34bKEIxNhskQkosOD0bKEI=?=")))
277
- expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCOl8kTiQzJE47fjRWJEckTyRJJCYkKyRKGyhC?=")))
273
+ context 'to_s' do
274
+ it 'should contain encoded subject' do
275
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCQD5OcRsoQjIwMTIbJEJHLxsoQjA5GyRCN24bKEIwMxskQkZ8JE86IxsoQg==?=')))
276
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCRnwkSyRKJGskbyQxJEAkLBsoQjEwGyRCO34bKEIxNhskQkosOD0bKEI=?=')))
277
+ expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape('=?ISO-2022-JP?B?GyRCOl8kTiQzJE47fjRWJEckTyRJJCYkKyRKGyhC?=')))
278
278
  end
279
279
  end
280
280
  end
281
281
  end
282
282
 
283
- context "with attachments" do
283
+ context 'with attachments' do
284
284
  before(:each) do
285
285
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
286
286
  @mail.mobile = @mobile
287
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
288
- @photo = open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/photo.jpg")).read
287
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
288
+ @photo = open(File.join(File.expand_path(File.dirname(__FILE__)), 'email-fixtures/photo.jpg')).read
289
289
  end
290
290
 
291
- it "should encodes itself successfully" do
291
+ it 'should encodes itself successfully' do
292
292
  @mail.attachments['photo.jpg'] = @photo
293
293
 
294
294
  expect {
@@ -296,7 +296,7 @@ describe "Jpmobile::Mail" do
296
296
  }.not_to raise_error
297
297
  end
298
298
 
299
- it "should encodes itself successfully with an inline attachment" do
299
+ it 'should encodes itself successfully with an inline attachment' do
300
300
  @mail.attachments.inline['photo.jpg'] = @photo
301
301
 
302
302
  expect {
@@ -304,7 +304,7 @@ describe "Jpmobile::Mail" do
304
304
  }.not_to raise_error
305
305
  end
306
306
 
307
- it "should encodes itself successfully with an UTF-8 filename attachment" do
307
+ it 'should encodes itself successfully with an UTF-8 filename attachment' do
308
308
  @mail.attachments.inline['日本語のファイル名です.jpg'] = @photo
309
309
 
310
310
  expect {
@@ -313,36 +313,46 @@ describe "Jpmobile::Mail" do
313
313
  end
314
314
  end
315
315
 
316
- context "encoding conversion" do
316
+ context 'encoding conversion' do
317
317
  before(:each) do
318
318
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
319
319
  @mail.mobile = @mobile
320
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
321
- @photo = open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/photo.jpg")).read
320
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
321
+ @photo = open(File.join(File.expand_path(File.dirname(__FILE__)), 'email-fixtures/photo.jpg')).read
322
322
  end
323
323
 
324
- it "wave dash converting correctly" do
324
+ it 'wave dash converting correctly' do
325
325
  @mail.body = '10:00〜12:00'
326
326
 
327
327
  expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("\x31\x30\x3a\x30\x30\x1b\x24\x42\x21\x41\x1b\x28\x42\x31\x32\x3a\x30\x30"))))
328
328
  end
329
329
 
330
- it "full width tilde converting correctly" do
330
+ it 'full width tilde converting correctly' do
331
331
  @mail.body = "10:00#{[0xff5e].pack("U")}12:00"
332
332
 
333
333
  expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape(ascii_8bit("\x31\x30\x3a\x30\x30\x1b\x24\x42\x21\x41\x1b\x28\x42\x31\x32\x3a\x30\x30"))))
334
334
  end
335
335
  end
336
336
 
337
- context "delivering" do
337
+ context 'delivering' do
338
338
  before(:each) do
339
339
  @mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
340
340
  @mail.mobile = @mobile
341
- @mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
341
+ @mail.to = 'むすめふさほせ <info+to@jpmobile-rails.org>'
342
342
  end
343
343
 
344
- it "delivers through SMTP" do
345
- @mail.delivery_method :smtp, {:enable_starttls_auto => false}
344
+ it 'delivers through SMTP' do
345
+ @mail.delivery_method :smtp,
346
+ {
347
+ enable_starttls_auto: false,
348
+ user_name: ENV['MAILTRAP_USERNAME'],
349
+ password: ENV['MAILTRAP_PASSWORD'],
350
+ address: 'smtp.mailtrap.io',
351
+ domain: 'smtp.mailtrap.io',
352
+ port: '2525',
353
+ authentication: :cram_md5,
354
+ }
355
+
346
356
  expect {
347
357
  @mail.deliver
348
358
  }.not_to raise_error
@@ -354,8 +364,8 @@ describe "Jpmobile::Mail" do
354
364
  context 'sending with carrier from' do
355
365
  before do
356
366
  @mail = Mail.new
357
- @mail.subject = "万葉"
358
- @mail.to = "ちはやふる <info@jpmobile-rails.org>"
367
+ @mail.subject = '万葉'
368
+ @mail.to = 'ちはやふる <info@jpmobile-rails.org>'
359
369
  end
360
370
 
361
371
  it 'should convert content-transfer-encoding' do