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
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- describe MobileMailer do
3
+ describe MobileMailer, :type => :mailer do
4
4
  include Jpmobile::Util
5
5
 
6
6
  before(:each) do
@@ -17,46 +17,46 @@ describe MobileMailer do
17
17
  it "正常に送信できること" do
18
18
  email = MobileMailer.view_selection(@to, "題名", "本文").deliver
19
19
 
20
- ActionMailer::Base.deliveries.size.should == 1
21
- email.to.include?(@to).should be_truthy
20
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
21
+ expect(email.to.include?(@to)).to be_truthy
22
22
  end
23
23
 
24
24
  it "ISO-2022-JPに変換されること" do
25
25
  email = MobileMailer.view_selection(@to, "題名", "本文").deliver
26
26
 
27
- ActionMailer::Base.deliveries.size.should == 1
27
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
28
28
 
29
29
  raw_mail = ascii_8bit(email.to_s)
30
- raw_mail.should match(/iso-2022-jp/i)
31
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis("題名")].pack('m').strip))))
32
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
30
+ expect(raw_mail).to match(/iso-2022-jp/i)
31
+ expect(raw_mail).to match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis("題名")].pack('m').strip))))
32
+ expect(raw_mail).to match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
33
33
  end
34
34
 
35
35
  it "絵文字がゲタ(〓)に変換されること" do
36
36
  email = MobileMailer.view_selection(@to, "題名", "本文".html_safe).deliver
37
37
 
38
- ActionMailer::Base.deliveries.size.should == 1
38
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
39
39
 
40
40
  raw_mail = ascii_8bit(email.to_s)
41
- raw_mail.should match(Regexp.escape("GyRCQmpMPiIuGyhC"))
42
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文〓")))))
41
+ expect(raw_mail).to match(Regexp.escape("GyRCQmpMPiIuGyhC"))
42
+ expect(raw_mail).to match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文〓")))))
43
43
  end
44
44
 
45
45
  it "quoted-printableではないときに勝手に変換されないこと" do
46
46
  email = MobileMailer.view_selection(@to, "題名",
47
47
  "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
48
48
 
49
- ActionMailer::Base.deliveries.size.should == 1
49
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
50
50
 
51
51
  raw_mail = ascii_8bit(email.to_s)
52
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
52
+ expect(raw_mail).to match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
53
53
  end
54
54
 
55
55
  context ":toの指定が" do
56
56
  it "ない場合でも正常に送信できること" do
57
57
  email = MobileMailer.default_to_mail('題名', '本文').deliver
58
58
 
59
- ActionMailer::Base.deliveries.size.should == 1
59
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
60
60
  end
61
61
  end
62
62
  end
@@ -71,13 +71,13 @@ describe MobileMailer do
71
71
  it "複数に配信するときもISO-2022-JPに変換されること" do
72
72
  email = MobileMailer.view_selection(@to, "題名", "本文").deliver
73
73
 
74
- ActionMailer::Base.deliveries.size.should == 1
74
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
75
75
 
76
76
  raw_mail = ascii_8bit(email.to_s)
77
- raw_mail.should match(/iso-2022-jp/i)
78
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis("題名")].pack('m').strip))))
79
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
80
- raw_mail.should match(/For PC/)
77
+ expect(raw_mail).to match(/iso-2022-jp/i)
78
+ expect(raw_mail).to match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis("題名")].pack('m').strip))))
79
+ expect(raw_mail).to match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
80
+ expect(raw_mail).to match(/For PC/)
81
81
  end
82
82
  end
83
83
 
@@ -89,13 +89,13 @@ describe MobileMailer do
89
89
  it "subject/body が Shift-JIS になること" do
90
90
  email = MobileMailer.view_selection(@to, @subject, @text).deliver
91
91
 
92
- ActionMailer::Base.deliveries.size.should == 1
92
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
93
93
 
94
94
  raw_mail = email.to_s
95
- raw_mail.should match(/shift_jis/i)
95
+ expect(raw_mail).to match(/shift_jis/i)
96
96
  # raw_mail.should match(/For docomo/)
97
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvA=="))
98
- raw_mail.should match(Regexp.compile(utf8_to_sjis(@text)))
97
+ expect(raw_mail).to match(Regexp.escape("k/qWe4zqkeiWvA=="))
98
+ expect(raw_mail).to match(Regexp.compile(utf8_to_sjis(@text)))
99
99
  end
100
100
 
101
101
  it "数値参照の絵文字が変換されること" do
@@ -104,12 +104,12 @@ describe MobileMailer do
104
104
 
105
105
  email = MobileMailer.view_selection(@to, emoji_subject, emoji_text.html_safe).deliver
106
106
 
107
- ActionMailer::Base.deliveries.size.should == 1
107
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
108
108
 
109
109
  raw_mail = email.to_s
110
- raw_mail.should match(/For docomo/)
111
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvPjX"))
112
- raw_mail.should match(regexp_to_sjis("\xf8\xec"))
110
+ expect(raw_mail).to match(/For docomo/)
111
+ expect(raw_mail).to match(Regexp.escape("k/qWe4zqkeiWvPjX"))
112
+ expect(raw_mail).to match(regexp_to_sjis("\xf8\xec"))
113
113
  end
114
114
 
115
115
  it "半角カナがそのまま送信されること" do
@@ -118,22 +118,22 @@ describe MobileMailer do
118
118
 
119
119
  email = MobileMailer.view_selection(@to, half_kana_subject, half_kana_text).deliver
120
120
 
121
- ActionMailer::Base.deliveries.size.should == 1
121
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
122
122
 
123
123
  raw_mail = email.to_s
124
- raw_mail.should match(/For docomo/)
125
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvLnesNE="))
126
- raw_mail.should match(Regexp.compile(Regexp.escape(utf8_to_sjis(half_kana_text))))
124
+ expect(raw_mail).to match(/For docomo/)
125
+ expect(raw_mail).to match(Regexp.escape("k/qWe4zqkeiWvLnesNE="))
126
+ expect(raw_mail).to match(Regexp.compile(Regexp.escape(utf8_to_sjis(half_kana_text))))
127
127
  end
128
128
 
129
129
  it "quoted-printable ではないときに勝手に変換されないこと" do
130
130
  email = MobileMailer.view_selection(@to, "題名",
131
131
  "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
132
132
 
133
- ActionMailer::Base.deliveries.size.should == 1
133
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
134
134
 
135
135
  raw_mail = email.to_s
136
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
136
+ expect(raw_mail).to match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
137
137
  end
138
138
  end
139
139
 
@@ -145,12 +145,12 @@ describe MobileMailer do
145
145
  it "subject/body がISO-2022-JPになること" do
146
146
  email = MobileMailer.view_selection(@to, @subject, @text).deliver
147
147
 
148
- ActionMailer::Base.deliveries.size.should == 1
148
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
149
149
 
150
150
  raw_mail = ascii_8bit(email.to_s)
151
- raw_mail.should match(/iso-2022-jp/i)
152
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis(@subject)].pack('m').strip))))
153
- raw_mail.should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis(@text)))))
151
+ expect(raw_mail).to match(/iso-2022-jp/i)
152
+ expect(raw_mail).to match(Regexp.compile(Regexp.escape(ascii_8bit([utf8_to_jis(@subject)].pack('m').strip))))
153
+ expect(raw_mail).to match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis(@text)))))
154
154
  end
155
155
 
156
156
  it "数値参照が絵文字に変換されること" do
@@ -159,22 +159,22 @@ describe MobileMailer do
159
159
 
160
160
  email = MobileMailer.view_selection(@to, emoji_subject, emoji_text.html_safe).deliver
161
161
 
162
- ActionMailer::Base.deliveries.size.should == 1
162
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
163
163
 
164
164
  raw_mail = ascii_8bit(email.to_s)
165
- raw_mail.should match(/For au/)
166
- raw_mail.should match(Regexp.escape("GyRCRnxLXDhsQmpMPnZeGyhC"))
167
- raw_mail.should match(Regexp.compile(ascii_8bit("\x76\x21")))
165
+ expect(raw_mail).to match(/For au/)
166
+ expect(raw_mail).to match(Regexp.escape("GyRCRnxLXDhsQmpMPnZeGyhC"))
167
+ expect(raw_mail).to match(Regexp.compile(ascii_8bit("\x76\x21")))
168
168
  end
169
169
 
170
170
  it "quoted-printable ではないときに勝手に変換されないこと" do
171
171
  email = MobileMailer.view_selection(@to, "題名",
172
172
  "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
173
173
 
174
- ActionMailer::Base.deliveries.size.should == 1
174
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
175
175
 
176
176
  raw_mail = ascii_8bit(email.to_s)
177
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
177
+ expect(raw_mail).to match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
178
178
  end
179
179
  end
180
180
 
@@ -186,13 +186,13 @@ describe MobileMailer do
186
186
  it "subject/body が Shift_JIS になること" do
187
187
  email = MobileMailer.view_selection(@to, @subject, @text).deliver
188
188
 
189
- ActionMailer::Base.deliveries.size.should == 1
189
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
190
190
 
191
191
  raw_mail = email.to_s
192
- raw_mail.should match(/shift_jis/i)
193
- raw_mail.should match(/For softbank/)
194
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvA=="))
195
- raw_mail.should match(Regexp.compile(utf8_to_sjis(@text)))
192
+ expect(raw_mail).to match(/shift_jis/i)
193
+ expect(raw_mail).to match(/For softbank/)
194
+ expect(raw_mail).to match(Regexp.escape("k/qWe4zqkeiWvA=="))
195
+ expect(raw_mail).to match(Regexp.compile(utf8_to_sjis(@text)))
196
196
  end
197
197
 
198
198
  it "数値参照が絵文字に変換されること" do
@@ -201,22 +201,22 @@ describe MobileMailer do
201
201
 
202
202
  email = MobileMailer.view_selection(@to, emoji_subject, emoji_text.html_safe).deliver
203
203
 
204
- ActionMailer::Base.deliveries.size.should == 1
204
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
205
205
 
206
206
  raw_mail = email.to_s
207
- raw_mail.should match(/For softbank/)
208
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvPl8"))
209
- raw_mail.should match(regexp_to_sjis("\xf7\x6a"))
207
+ expect(raw_mail).to match(/For softbank/)
208
+ expect(raw_mail).to match(Regexp.escape("k/qWe4zqkeiWvPl8"))
209
+ expect(raw_mail).to match(regexp_to_sjis("\xf7\x6a"))
210
210
  end
211
211
 
212
212
  it "quoted-printable ではないときに勝手に変換されないこと" do
213
213
  email = MobileMailer.view_selection(@to, "題名",
214
214
  "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
215
215
 
216
- ActionMailer::Base.deliveries.size.should == 1
216
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
217
217
 
218
218
  raw_mail = email.to_s
219
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
219
+ expect(raw_mail).to match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
220
220
  end
221
221
  end
222
222
 
@@ -228,13 +228,13 @@ describe MobileMailer do
228
228
  it "subject/body が Shift_JIS になること" do
229
229
  email = MobileMailer.view_selection(@to, @subject, @text).deliver
230
230
 
231
- ActionMailer::Base.deliveries.size.should == 1
231
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
232
232
 
233
233
  raw_mail = email.to_s
234
- raw_mail.should match(/shift_jis/i)
235
- raw_mail.should match(/For vodafone/)
236
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvA=="))
237
- raw_mail.should match(Regexp.compile(utf8_to_sjis(@text)))
234
+ expect(raw_mail).to match(/shift_jis/i)
235
+ expect(raw_mail).to match(/For vodafone/)
236
+ expect(raw_mail).to match(Regexp.escape("k/qWe4zqkeiWvA=="))
237
+ expect(raw_mail).to match(Regexp.compile(utf8_to_sjis(@text)))
238
238
  end
239
239
 
240
240
  it "数値参照が絵文字に変換されること" do
@@ -243,22 +243,22 @@ describe MobileMailer do
243
243
 
244
244
  email = MobileMailer.view_selection(@to, emoji_subject, emoji_text.html_safe).deliver
245
245
 
246
- ActionMailer::Base.deliveries.size.should == 1
246
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
247
247
 
248
248
  raw_mail = email.to_s
249
- raw_mail.should match(/For vodafone/)
250
- raw_mail.should match(Regexp.escape("k/qWe4zqkeiWvPl8"))
251
- raw_mail.should match(regexp_to_sjis("\xf7\x6a"))
249
+ expect(raw_mail).to match(/For vodafone/)
250
+ expect(raw_mail).to match(Regexp.escape("k/qWe4zqkeiWvPl8"))
251
+ expect(raw_mail).to match(regexp_to_sjis("\xf7\x6a"))
252
252
  end
253
253
 
254
254
  it "quoted-printable ではないときに勝手に変換されないこと" do
255
255
  email = MobileMailer.view_selection(@to, "題名",
256
256
  "本文です\nhttp://test.rails/foo/bar/index?d=430d0d1cea109cdb384ec5554b890e3940f293c7&e=ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L").deliver
257
257
 
258
- ActionMailer::Base.deliveries.size.should == 1
258
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
259
259
 
260
260
  raw_mail = email.to_s
261
- raw_mail.should match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
261
+ expect(raw_mail).to match(/ZVG%0FE%16%5E%07%04%21P%5CZ%06%00%0D%1D%40L/)
262
262
  end
263
263
  end
264
264
 
@@ -295,13 +295,13 @@ describe MobileMailer do
295
295
  it "漢字コードが変換されること" do
296
296
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
297
297
 
298
- ActionMailer::Base.deliveries.size.should == 1
298
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
299
299
 
300
- email.parts.size.should == 2
300
+ expect(email.parts.size).to eq(2)
301
301
 
302
302
  raw_mail = ascii_8bit(email.to_s)
303
- raw_mail.should match(Regexp.escape(ascii_8bit(utf8_to_jis(@text))))
304
- raw_mail.should match(Regexp.escape(ascii_8bit(utf8_to_jis(@html))))
303
+ expect(raw_mail).to match(Regexp.escape(ascii_8bit(utf8_to_jis(@text))))
304
+ expect(raw_mail).to match(Regexp.escape(ascii_8bit(utf8_to_jis(@html))))
305
305
  end
306
306
  end
307
307
 
@@ -313,13 +313,13 @@ describe MobileMailer do
313
313
  it "漢字コードが変換されること" do
314
314
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
315
315
 
316
- ActionMailer::Base.deliveries.size.should == 1
316
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
317
317
 
318
- email.parts.size.should == 2
318
+ expect(email.parts.size).to eq(2)
319
319
 
320
320
  raw_mail = email.to_s
321
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@text)))
322
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@html)))
321
+ expect(raw_mail).to match(sjis_regexp(utf8_to_sjis(@text)))
322
+ expect(raw_mail).to match(sjis_regexp(utf8_to_sjis(@html)))
323
323
  end
324
324
 
325
325
  it "絵文字が変換されること" do
@@ -327,13 +327,13 @@ describe MobileMailer do
327
327
  @html += ""
328
328
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
329
329
 
330
- ActionMailer::Base.deliveries.size.should == 1
330
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
331
331
 
332
- email.parts.size.should == 2
332
+ expect(email.parts.size).to eq(2)
333
333
 
334
334
  raw_mail = email.to_s
335
- raw_mail.should match(sjis_regexp(sjis("\xf8\xec")))
336
- raw_mail.should match(sjis_regexp(sjis("\xf8\xd7")))
335
+ expect(raw_mail).to match(sjis_regexp(sjis("\xf8\xec")))
336
+ expect(raw_mail).to match(sjis_regexp(sjis("\xf8\xd7")))
337
337
  end
338
338
  end
339
339
 
@@ -345,13 +345,13 @@ describe MobileMailer do
345
345
  it "漢字コードが変換されること" do
346
346
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
347
347
 
348
- ActionMailer::Base.deliveries.size.should == 1
348
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
349
349
 
350
- email.parts.size.should == 2
350
+ expect(email.parts.size).to eq(2)
351
351
 
352
352
  raw_mail = ascii_8bit(email.to_s)
353
- raw_mail.should match(Regexp.escape(ascii_8bit(utf8_to_jis(@text))))
354
- raw_mail.should match(Regexp.escape(ascii_8bit(utf8_to_jis(@html))))
353
+ expect(raw_mail).to match(Regexp.escape(ascii_8bit(utf8_to_jis(@text))))
354
+ expect(raw_mail).to match(Regexp.escape(ascii_8bit(utf8_to_jis(@html))))
355
355
  end
356
356
 
357
357
  it "絵文字が変換されること" do
@@ -359,13 +359,13 @@ describe MobileMailer do
359
359
  @html += ""
360
360
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
361
361
 
362
- ActionMailer::Base.deliveries.size.should == 1
362
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
363
363
 
364
- email.parts.size.should == 2
364
+ expect(email.parts.size).to eq(2)
365
365
 
366
366
  raw_mail = ascii_8bit(email.to_s)
367
- raw_mail.should match(jis_regexp("\x76\x21"))
368
- raw_mail.should match(jis_regexp("\x76\x5e"))
367
+ expect(raw_mail).to match(jis_regexp("\x76\x21"))
368
+ expect(raw_mail).to match(jis_regexp("\x76\x5e"))
369
369
  end
370
370
  end
371
371
 
@@ -377,13 +377,13 @@ describe MobileMailer do
377
377
  it "漢字コードが変換されること" do
378
378
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
379
379
 
380
- ActionMailer::Base.deliveries.size.should == 1
380
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
381
381
 
382
- email.parts.size.should == 2
382
+ expect(email.parts.size).to eq(2)
383
383
 
384
384
  raw_mail = email.to_s
385
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@text)))
386
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@html)))
385
+ expect(raw_mail).to match(sjis_regexp(utf8_to_sjis(@text)))
386
+ expect(raw_mail).to match(sjis_regexp(utf8_to_sjis(@html)))
387
387
  end
388
388
 
389
389
  it "絵文字が変換されること" do
@@ -391,13 +391,13 @@ describe MobileMailer do
391
391
  @html += ""
392
392
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
393
393
 
394
- ActionMailer::Base.deliveries.size.should == 1
394
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
395
395
 
396
- email.parts.size.should == 2
396
+ expect(email.parts.size).to eq(2)
397
397
 
398
398
  raw_mail = email.to_s
399
- raw_mail.should match(sjis_regexp(sjis("\xf7\x6a")))
400
- raw_mail.should match(sjis_regexp(sjis("\xf9\x7c")))
399
+ expect(raw_mail).to match(sjis_regexp(sjis("\xf7\x6a")))
400
+ expect(raw_mail).to match(sjis_regexp(sjis("\xf9\x7c")))
401
401
  end
402
402
  end
403
403
 
@@ -409,13 +409,13 @@ describe MobileMailer do
409
409
  it "漢字コードが変換されること" do
410
410
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
411
411
 
412
- ActionMailer::Base.deliveries.size.should == 1
412
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
413
413
 
414
- email.parts.size.should == 2
414
+ expect(email.parts.size).to eq(2)
415
415
 
416
416
  raw_mail = email.to_s
417
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@text)))
418
- raw_mail.should match(sjis_regexp(utf8_to_sjis(@html)))
417
+ expect(raw_mail).to match(sjis_regexp(utf8_to_sjis(@text)))
418
+ expect(raw_mail).to match(sjis_regexp(utf8_to_sjis(@html)))
419
419
  end
420
420
 
421
421
  it "絵文字が変換されること" do
@@ -423,19 +423,19 @@ describe MobileMailer do
423
423
  @html += ""
424
424
  email = MobileMailer.multi_message(@to, @subject, @text, @html).deliver
425
425
 
426
- ActionMailer::Base.deliveries.size.should == 1
426
+ expect(ActionMailer::Base.deliveries.size).to eq(1)
427
427
 
428
- email.parts.size.should == 2
428
+ expect(email.parts.size).to eq(2)
429
429
 
430
430
  raw_mail = email.to_s
431
- raw_mail.should match(sjis_regexp(sjis("\xf7\x6a")))
432
- raw_mail.should match(sjis_regexp(sjis("\xf9\x7c")))
431
+ expect(raw_mail).to match(sjis_regexp(sjis("\xf7\x6a")))
432
+ expect(raw_mail).to match(sjis_regexp(sjis("\xf9\x7c")))
433
433
  end
434
434
  end
435
435
  end
436
436
  end
437
437
 
438
- describe MobileMailer, " mail address" do
438
+ describe MobileMailer, " mail address", :type => :mailer do
439
439
  before(:each) do
440
440
  ActionMailer::Base.deliveries = []
441
441
 
@@ -448,9 +448,9 @@ describe MobileMailer, " mail address" do
448
448
  MobileMailer.view_selection(to, @subject, @text).deliver
449
449
 
450
450
  emails = ActionMailer::Base.deliveries
451
- emails.size.should == 1
452
- emails.first.to.include?(to).should be_truthy
453
- emails.first.destinations.include?(to).should be_truthy
451
+ expect(emails.size).to eq(1)
452
+ expect(emails.first.to.include?(to)).to be_truthy
453
+ expect(emails.first.destinations.include?(to)).to be_truthy
454
454
  end
455
455
 
456
456
  it "@マークの直前にピリオドあるアドレスが有効になること" do
@@ -458,9 +458,9 @@ describe MobileMailer, " mail address" do
458
458
  MobileMailer.view_selection(to, @subject, @text).deliver
459
459
 
460
460
  emails = ActionMailer::Base.deliveries
461
- emails.size.should == 1
462
- emails.first.to.include?(to).should be_truthy
463
- emails.first.destinations.include?(to).should be_truthy
461
+ expect(emails.size).to eq(1)
462
+ expect(emails.first.to.include?(to)).to be_truthy
463
+ expect(emails.first.destinations.include?(to)).to be_truthy
464
464
  end
465
465
 
466
466
  it "ピリオドから始まるアドレスが有効になること" do
@@ -468,9 +468,9 @@ describe MobileMailer, " mail address" do
468
468
  MobileMailer.view_selection(to, @subject, @text).deliver
469
469
 
470
470
  emails = ActionMailer::Base.deliveries
471
- emails.size.should == 1
472
- emails.first.to.include?(to).should be_truthy
473
- emails.first.destinations.include?(to).should be_truthy
471
+ expect(emails.size).to eq(1)
472
+ expect(emails.first.to.include?(to)).to be_truthy
473
+ expect(emails.first.destinations.include?(to)).to be_truthy
474
474
  end
475
475
 
476
476
  it "複数のアドレスが有効になること" do
@@ -478,13 +478,13 @@ describe MobileMailer, " mail address" do
478
478
  MobileMailer.view_selection(to.join(", "), @subject, @text).deliver
479
479
 
480
480
  emails = ActionMailer::Base.deliveries
481
- emails.size.should == 1
482
- emails.first.to.should == to
483
- emails.first.destinations.should == to
481
+ expect(emails.size).to eq(1)
482
+ expect(emails.first.to).to eq(to)
483
+ expect(emails.first.destinations).to eq(to)
484
484
  end
485
485
  end
486
486
 
487
- describe MobileMailer, "receiving" do
487
+ describe MobileMailer, "receiving", :type => :mailer do
488
488
  describe "blank mail" do
489
489
  it "softbank からの空メールがで受信できること" do
490
490
  email = open(Rails.root + "spec/fixtures/mobile_mailer/softbank-blank.eml").read
@@ -492,8 +492,8 @@ describe MobileMailer, "receiving" do
492
492
  email = MobileMailer.receive(email)
493
493
  # }.to_not raise_error
494
494
 
495
- email.subject.should be_blank
496
- email.body.should be_blank
495
+ expect(email.subject).to be_blank
496
+ expect(email.body).to be_blank
497
497
  end
498
498
  end
499
499
 
@@ -504,15 +504,15 @@ describe MobileMailer, "receiving" do
504
504
 
505
505
  it "漢字コードを適切に変換できること" do
506
506
  email = MobileMailer.receive(@email)
507
- email.subject.should match(/題名/)
508
- email.body.should match(/本文/)
507
+ expect(email.subject).to match(/題名/)
508
+ expect(email.body).to match(/本文/)
509
509
  end
510
510
 
511
511
  it "絵文字が数値参照に変わること" do
512
512
  email = MobileMailer.receive(@email)
513
513
 
514
- email.subject.should match(//)
515
- email.body.should match(//)
514
+ expect(email.subject).to match(//)
515
+ expect(email.body).to match(//)
516
516
  end
517
517
 
518
518
  describe "jis コードの場合に" do
@@ -523,8 +523,8 @@ describe MobileMailer, "receiving" do
523
523
  it "適切に変換できること" do
524
524
  email = MobileMailer.receive(@email)
525
525
 
526
- email.subject.should match(/テスト/)
527
- email.body.should match(/テスト本文/)
526
+ expect(email.subject).to match(/テスト/)
527
+ expect(email.body).to match(/テスト本文/)
528
528
  end
529
529
  end
530
530
  end
@@ -538,15 +538,15 @@ describe MobileMailer, "receiving" do
538
538
  it "漢字コードを適切に変換できること" do
539
539
  email = MobileMailer.receive(@email)
540
540
 
541
- email.subject.should match(/題名/)
542
- email.body.should match(/本文/)
541
+ expect(email.subject).to match(/題名/)
542
+ expect(email.body).to match(/本文/)
543
543
  end
544
544
 
545
545
  it "絵文字が数値参照に変わること" do
546
546
  email = MobileMailer.receive(@email)
547
547
 
548
- email.subject.should match(//)
549
- email.body.should match(//)
548
+ expect(email.subject).to match(//)
549
+ expect(email.body).to match(//)
550
550
  end
551
551
  end
552
552
 
@@ -558,15 +558,15 @@ describe MobileMailer, "receiving" do
558
558
  it "漢字コードを適切に変換できること" do
559
559
  email = MobileMailer.receive(@email)
560
560
 
561
- email.subject.should match(/題名/)
562
- email.body.should match(/本文/)
561
+ expect(email.subject).to match(/題名/)
562
+ expect(email.body).to match(/本文/)
563
563
  end
564
564
 
565
565
  it "絵文字が数値参照に変わること" do
566
566
  email = MobileMailer.receive(@email)
567
567
 
568
- email.subject.should match(//)
569
- email.body.should match(//)
568
+ expect(email.subject).to match(//)
569
+ expect(email.body).to match(//)
570
570
  end
571
571
  end
572
572
  end
@@ -580,15 +580,15 @@ describe MobileMailer, "receiving" do
580
580
  it "漢字コードを適切に変換できること" do
581
581
  email = MobileMailer.receive(@email)
582
582
 
583
- email.subject.should match(/題名/)
584
- email.body.should match(/本文/)
583
+ expect(email.subject).to match(/題名/)
584
+ expect(email.body).to match(/本文/)
585
585
  end
586
586
 
587
587
  it "絵文字が数値参照に変わること" do
588
588
  email = MobileMailer.receive(@email)
589
589
 
590
- email.subject.should match(//)
591
- email.body.should match(//)
590
+ expect(email.subject).to match(//)
591
+ expect(email.body).to match(//)
592
592
  end
593
593
  end
594
594
 
@@ -600,15 +600,15 @@ describe MobileMailer, "receiving" do
600
600
  it "漢字コードを適切に変換できること" do
601
601
  email = MobileMailer.receive(@email)
602
602
 
603
- email.subject.should match(/題名/)
604
- email.body.should match(/本文/)
603
+ expect(email.subject).to match(/題名/)
604
+ expect(email.body).to match(/本文/)
605
605
  end
606
606
 
607
607
  it "絵文字が数値参照に変わること" do
608
608
  email = MobileMailer.receive(@email)
609
609
 
610
- email.subject.should match(//)
611
- email.body.should match(//)
610
+ expect(email.subject).to match(//)
611
+ expect(email.body).to match(//)
612
612
  end
613
613
  end
614
614
  end
@@ -621,22 +621,22 @@ describe MobileMailer, "receiving" do
621
621
  end
622
622
 
623
623
  it "正常に受信できること" do
624
- lambda {
624
+ expect {
625
625
  MobileMailer.receive(@email)
626
- }.should_not raise_exception
626
+ }.not_to raise_exception
627
627
  end
628
628
 
629
629
  it "絵文字が変換されること" do
630
630
  email = MobileMailer.receive(@email)
631
631
 
632
- email.subject.should match(//)
632
+ expect(email.subject).to match(//)
633
633
 
634
- email.parts.size.should == 1
634
+ expect(email.parts.size).to eq(1)
635
635
  email.parts.first.parts.size == 2
636
636
 
637
637
  parts = email.parts.first.parts
638
- parts.first.body.should match("テストです")
639
- parts.last.body.raw_source.should match("テストです")
638
+ expect(parts.first.body).to match("テストです")
639
+ expect(parts.last.body.raw_source).to match("テストです")
640
640
  end
641
641
  end
642
642
 
@@ -646,30 +646,30 @@ describe MobileMailer, "receiving" do
646
646
  end
647
647
 
648
648
  it "正常に受信できること" do
649
- lambda {
649
+ expect {
650
650
  MobileMailer.receive(@email)
651
- }.should_not raise_exception
651
+ }.not_to raise_exception
652
652
  end
653
653
 
654
654
  it "絵文字が変換されること" do
655
655
  email = MobileMailer.receive(@email)
656
656
 
657
- email.subject.should match(//)
657
+ expect(email.subject).to match(//)
658
658
 
659
- email.parts.size.should == 1
660
- email.parts.first.parts.size == 2
659
+ expect(email.parts.size).to eq(1)
660
+ expect(email.parts.first.parts.size).to eq(2)
661
661
 
662
662
  parts = email.parts.first.parts
663
- parts.first.body.should match(/テストです/)
664
- parts.last.body.raw_source.should match(/テストです/)
663
+ expect(parts.first.body).to match(/テストです/)
664
+ expect(parts.last.body.raw_source).to match(/テストです/)
665
665
  end
666
666
 
667
667
  context 'iPhone' do
668
668
  it 'should parse correctly' do
669
- lambda {
669
+ expect {
670
670
  @mail = MobileMailer.receive(open(File.join(Rails.root, "../../../spec/unit/email-fixtures/iphone-message.eml")).read)
671
671
  @mail.encoded
672
- }.should_not raise_error
672
+ }.not_to raise_error
673
673
  end
674
674
  end
675
675
  end
@@ -681,20 +681,20 @@ describe MobileMailer, "receiving" do
681
681
  end
682
682
 
683
683
  it "正常に受信できること" do
684
- lambda {
684
+ expect {
685
685
  MobileMailer.receive(@email)
686
- }.should_not raise_exception
686
+ }.not_to raise_exception
687
687
  end
688
688
 
689
689
  it "絵文字が変換されること" do
690
690
  email = MobileMailer.receive(@email)
691
691
 
692
- email.subject.should match(//)
692
+ expect(email.subject).to match(//)
693
693
 
694
- email.parts.size.should == 2
694
+ expect(email.parts.size).to eq(2)
695
695
 
696
- email.parts.first.body.should match(/テストです/)
697
- email.parts.last.body.raw_source.should match(/テストです/)
696
+ expect(email.parts.first.body).to match(/テストです/)
697
+ expect(email.parts.last.body.raw_source).to match(/テストです/)
698
698
  end
699
699
  end
700
700
 
@@ -705,20 +705,20 @@ describe MobileMailer, "receiving" do
705
705
  end
706
706
 
707
707
  it "正常に受信できること" do
708
- lambda {
708
+ expect {
709
709
  MobileMailer.receive(@email)
710
- }.should_not raise_exception
710
+ }.not_to raise_exception
711
711
  end
712
712
 
713
713
  it "絵文字が変換されること" do
714
714
  email = MobileMailer.receive(@email)
715
715
 
716
- email.subject.should match(/テストです/)
716
+ expect(email.subject).to match(/テストです/)
717
717
 
718
- email.parts.size.should == 2
718
+ expect(email.parts.size).to eq(2)
719
719
 
720
- email.parts.first.body.should match(/テストです/)
721
- email.parts.last.body.raw_source.should match(/テストです/)
720
+ expect(email.parts.first.body).to match(/テストです/)
721
+ expect(email.parts.last.body.raw_source).to match(/テストです/)
722
722
  end
723
723
  end
724
724
 
@@ -729,23 +729,23 @@ describe MobileMailer, "receiving" do
729
729
  end
730
730
 
731
731
  it "正常に受信できること" do
732
- lambda {
732
+ expect {
733
733
  MobileMailer.receive(@email)
734
- }.should_not raise_exception
734
+ }.not_to raise_exception
735
735
  end
736
736
 
737
737
  it "添付ファイルが壊れないこと" do
738
738
  email = MobileMailer.receive(@email)
739
739
 
740
- email.subject.should match(//)
740
+ expect(email.subject).to match(//)
741
741
 
742
- email.parts.size.should == 2
742
+ expect(email.parts.size).to eq(2)
743
743
 
744
- email.parts.first.body.should match(/カレンダーだ/)
744
+ expect(email.parts.first.body).to match(/カレンダーだ/)
745
745
 
746
- email.has_attachments?.should be_truthy
747
- email.attachments.size.should == 1
748
- email.attachments['20098calendar01.jpg'].content_type.should match("image/jpeg")
746
+ expect(email.has_attachments?).to be_truthy
747
+ expect(email.attachments.size).to eq(1)
748
+ expect(email.attachments['20098calendar01.jpg'].content_type).to match("image/jpeg")
749
749
  email.attachments['20098calendar01.jpg'].body.to_s[2..6] == "JFIF"
750
750
  email.attachments['20098calendar01.jpg'].body.to_s.size == 86412
751
751
  end
@@ -759,14 +759,14 @@ describe MobileMailer, "receiving" do
759
759
  end
760
760
 
761
761
  it "正常に受信できること" do
762
- lambda {
762
+ expect {
763
763
  MobileMailer.receive(@email)
764
- }.should_not raise_exception
764
+ }.not_to raise_exception
765
765
  end
766
766
 
767
767
  it "mobile が nil であること" do
768
768
  mail = MobileMailer.receive(@email)
769
- mail.mobile.should be_nil
769
+ expect(mail.mobile).to be_nil
770
770
  end
771
771
  end
772
772
 
@@ -776,14 +776,14 @@ describe MobileMailer, "receiving" do
776
776
  end
777
777
 
778
778
  it "正常に受信できること" do
779
- lambda {
779
+ expect {
780
780
  MobileMailer.receive(@email)
781
- }.should_not raise_exception
781
+ }.not_to raise_exception
782
782
  end
783
783
 
784
784
  it "mobile が nil であること" do
785
785
  mail = MobileMailer.receive(@email)
786
- mail.mobile.should be_nil
786
+ expect(mail.mobile).to be_nil
787
787
  end
788
788
  end
789
789
  end