jpmobile 4.1.1 → 4.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/jpmobile.gemspec +2 -0
- data/lib/jpmobile/emoticon.rb +3 -3
- data/lib/jpmobile/filter.rb +1 -1
- data/lib/jpmobile/mail.rb +3 -3
- data/lib/jpmobile/mobile/abstract_mobile.rb +5 -2
- data/lib/jpmobile/resolver.rb +17 -1
- data/lib/jpmobile/version.rb +1 -1
- data/lib/tasks/jpmobile_tasks.rake +5 -11
- data/spec/rack/jpmobile/android_spec.rb +4 -4
- data/spec/rack/jpmobile/au_spec.rb +46 -46
- data/spec/rack/jpmobile/black_berry_spec.rb +4 -4
- data/spec/rack/jpmobile/docomo_spec.rb +52 -52
- data/spec/rack/jpmobile/emoticon_spec.rb +67 -67
- data/spec/rack/jpmobile/filter_spec.rb +36 -36
- data/spec/rack/jpmobile/iphone_spec.rb +5 -5
- data/spec/rack/jpmobile/mobile_by_ua_spec.rb +2 -2
- data/spec/rack/jpmobile/params_filter_spec.rb +30 -30
- data/spec/rack/jpmobile/softbank_spec.rb +39 -39
- data/spec/rack/jpmobile/willcom_spec.rb +12 -12
- data/spec/rack/jpmobile/windows_phone.rb +4 -4
- data/spec/unit/decorated_mail_spec.rb +3 -3
- data/spec/unit/email_spec.rb +6 -6
- data/spec/unit/emoticon_spec.rb +33 -33
- data/spec/unit/encoding_spec.rb +14 -14
- data/spec/unit/is_carrier_spec.rb +1 -1
- data/spec/unit/mail_spec.rb +63 -63
- data/spec/unit/mobile/iphone_spec.rb +6 -6
- data/spec/unit/receive_mail_spec.rb +75 -75
- data/spec/unit/util_spec.rb +34 -34
- data/spec/unit/valid_ip_spec.rb +2 -2
- data/spec/unit/variants_spec.rb +40 -10
- data/test/rails/overrides/Gemfile +3 -3
- data/test/rails/overrides/spec/controllers/docomo_guid_spec.rb +6 -6
- data/test/rails/overrides/spec/controllers/helpers_spec.rb +22 -22
- data/test/rails/overrides/spec/controllers/mobile_spec_controller_spec.rb +19 -19
- data/test/rails/overrides/spec/controllers/template_path_spec.rb +8 -8
- data/test/rails/overrides/spec/controllers/trans_sid_controller_spec.rb +2 -2
- data/test/rails/overrides/spec/features/admin/top_spec.rb +3 -3
- data/test/rails/overrides/spec/features/filter_spec.rb +32 -32
- data/test/rails/overrides/spec/helpers/helpers_spec.rb +3 -3
- data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +3 -3
- data/test/rails/overrides/spec/mailers/mobile_mailer_spec.rb +179 -179
- data/test/rails/overrides/spec/mailers/normal_mailer_spec.rb +7 -7
- data/test/rails/overrides/spec/requests/docomo_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/emobile_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/pc_spec.rb +3 -3
- data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +6 -6
- data/test/rails/overrides/spec/requests/template_path_spec.rb +24 -24
- data/test/rails/overrides/spec/requests/trans_sid_spec.rb +16 -16
- metadata +39 -25
data/spec/unit/encoding_spec.rb
CHANGED
@@ -11,13 +11,13 @@ describe "Jpmobile::Mobile" do
|
|
11
11
|
|
12
12
|
context "to_mail_subject" do
|
13
13
|
it "should convert string to ISO-2022-JP B-Encoding when string contains Japanese" do
|
14
|
-
@mobile.to_mail_subject("ほげ").
|
14
|
+
expect(@mobile.to_mail_subject("ほげ")).to eq("=?ISO-2022-JP?B?GyRCJFskMhsoQg==?=")
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
context "to_mail_body" do
|
19
19
|
it "should convert string to ISO-2022-JP when string contains Japanese" do
|
20
|
-
@mobile.to_mail_body("ほげ").
|
20
|
+
expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_jis("ほげ"))
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -29,21 +29,21 @@ describe "Jpmobile::Mobile" do
|
|
29
29
|
|
30
30
|
context "to_mail_subject" do
|
31
31
|
it "should convert string to Shift_JIS B-Encoding when string contains Japanese" do
|
32
|
-
@mobile.to_mail_subject("ほげ").
|
32
|
+
expect(@mobile.to_mail_subject("ほげ")).to eq("=?Shift_JIS?B?gtmCsA==?=")
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should convert emoticon  to \xf8\x9f in B-Encoding" do
|
36
|
-
@mobile.to_mail_subject("ほげ").
|
36
|
+
expect(@mobile.to_mail_subject("ほげ")).to eq("=?Shift_JIS?B?gtmCsPif?=")
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
40
|
context "to_mail_body" do
|
41
41
|
it "should convert string to Shift_JIS when string contains Japanese" do
|
42
|
-
@mobile.to_mail_body("ほげ").
|
42
|
+
expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_sjis("ほげ"))
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should convert emoticon  to \xf8\x9f" do
|
46
|
-
@mobile.to_mail_body("ほげ").
|
46
|
+
expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_sjis("ほげ") + sjis("\xf8\x9f"))
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -55,21 +55,21 @@ describe "Jpmobile::Mobile" do
|
|
55
55
|
|
56
56
|
context "to_mail_subject" do
|
57
57
|
it "should convert string to ISO-2022-JP B-Encoding when string contains Japanese" do
|
58
|
-
@mobile.to_mail_subject("ほげ").
|
58
|
+
expect(@mobile.to_mail_subject("ほげ")).to eq("=?ISO-2022-JP?B?GyRCJFskMhsoQg==?=")
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should convert emoticon  to \x75\x41 in B-Encoding" do
|
62
|
-
@mobile.to_mail_subject("ほげ").
|
62
|
+
expect(@mobile.to_mail_subject("ほげ")).to eq("=?ISO-2022-JP?B?GyRCJFskMnVBGyhC?=")
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
context "to_mail_body" do
|
67
67
|
it "should convert string to ISO-2022-JP when string contains Japanese" do
|
68
|
-
@mobile.to_mail_body("ほげ").
|
68
|
+
expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_jis("ほげ"))
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should convert emoticon  to \x75\x41" do
|
72
|
-
ascii_8bit(@mobile.to_mail_body("ほげ")).
|
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")))
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
@@ -81,21 +81,21 @@ describe "Jpmobile::Mobile" do
|
|
81
81
|
|
82
82
|
context "to_mail_subject" do
|
83
83
|
it "should convert string to Shift_JIS B-Encoding when string contains Japanese" do
|
84
|
-
@mobile.to_mail_subject("ほげ").
|
84
|
+
expect(@mobile.to_mail_subject("ほげ")).to eq("=?Shift_JIS?B?gtmCsA==?=")
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should convert emoticon  to \xf9\x8b in B-Encoding" do
|
88
|
-
@mobile.to_mail_subject("ほげ").
|
88
|
+
expect(@mobile.to_mail_subject("ほげ")).to eq("=?Shift_JIS?B?gtmCsPmL?=")
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
92
|
context "to_mail_body" do
|
93
93
|
it "should convert string to Shift_JIS when string contains Japanese" do
|
94
|
-
@mobile.to_mail_body("ほげ").
|
94
|
+
expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_sjis("ほげ"))
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should convert emoticon  to \xf9\x8b" do
|
98
|
-
@mobile.to_mail_body("ほげ").
|
98
|
+
expect(@mobile.to_mail_body("ほげ")).to eq(utf8_to_sjis("ほげ") + sjis("\xf9\x8b"))
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -59,7 +59,7 @@ describe 'Jpmobile::Mobile' do
|
|
59
59
|
[ %w[ Ddipocket ddipocket ] , true ],
|
60
60
|
].each do |carrier, expected|
|
61
61
|
it "#{carrier.first}##{carrier.last}? should be return #{expected}" do
|
62
|
-
Jpmobile::Mobile.const_get(carrier.first).new({}, {}).__send__("#{carrier.last}?").
|
62
|
+
expect(Jpmobile::Mobile.const_get(carrier.first).new({}, {}).__send__("#{carrier.last}?")).to eq(expected)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
data/spec/unit/mail_spec.rb
CHANGED
@@ -53,23 +53,23 @@ describe "Jpmobile::Mail" do
|
|
53
53
|
|
54
54
|
context "to_s" do
|
55
55
|
it "should contain encoded subject" do
|
56
|
-
ascii_8bit(@mail.to_s).
|
56
|
+
expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQg==?=")))
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should contain encoded body" do
|
60
|
-
ascii_8bit(@mail.to_s).
|
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
63
|
it "should contain encoded from"do
|
64
|
-
ascii_8bit(@mail.to_s).
|
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
67
|
it "should contain encoded to" do
|
68
|
-
ascii_8bit(@mail.to_s).
|
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
71
|
it "should contain correct Content-Type:" do
|
72
|
-
ascii_8bit(@mail.to_s).
|
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
|
@@ -83,27 +83,27 @@ describe "Jpmobile::Mail" do
|
|
83
83
|
|
84
84
|
context "to_s" do
|
85
85
|
it "should contain encoded subject" do
|
86
|
-
@mail.to_s.
|
86
|
+
expect(@mail.to_s).to match(sjis_regexp("=?Shift_JIS?B?lpyXdA==?="))
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should contain encoded body" do
|
90
|
-
@mail.to_s.
|
90
|
+
expect(@mail.to_s).to match(Regexp.escape(utf8_to_sjis("ほげ")))
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should contain encoded from" do
|
94
|
-
@mail.to_s.
|
94
|
+
expect(@mail.to_s).to match(sjis_regexp("gr+CzYLigtOC6Q=="))
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should contain encoded to" do
|
98
|
-
@mail.to_s.
|
98
|
+
expect(@mail.to_s).to match(sjis_regexp("gt6Ct4LfgtOCs4LZgrk="))
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should contains encoded emoticon" do
|
102
102
|
@mail.subject += ""
|
103
103
|
@mail.body = "#{@mail.body}"
|
104
104
|
|
105
|
-
@mail.to_s.
|
106
|
-
@mail.to_s.
|
105
|
+
expect(@mail.to_s).to match(Regexp.escape("=?Shift_JIS?B?lpyXdPif?="))
|
106
|
+
expect(@mail.to_s).to match(sjis_regexp("\xF8\x9F"))
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
@@ -117,27 +117,27 @@ describe "Jpmobile::Mail" do
|
|
117
117
|
|
118
118
|
context "to_s" do
|
119
119
|
it "should contain encoded subject" do
|
120
|
-
ascii_8bit(@mail.to_s).
|
120
|
+
expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQg==?=")))
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should contain encoded body" do
|
124
|
-
ascii_8bit(@mail.to_s).
|
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
127
|
it "should contain encoded from" do
|
128
|
-
ascii_8bit(@mail.to_s).
|
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
131
|
it "should contain encoded to" do
|
132
|
-
ascii_8bit(@mail.to_s).
|
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
135
|
it "should contain encoded emoticon" do
|
136
136
|
@mail.subject += ""
|
137
137
|
@mail.body = "#{@mail.body}"
|
138
138
|
|
139
|
-
ascii_8bit(@mail.to_s).
|
140
|
-
ascii_8bit(@mail.to_s).
|
139
|
+
expect(ascii_8bit(@mail.to_s)).to match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVXVBGyhC?=")))
|
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
|
@@ -151,27 +151,27 @@ describe "Jpmobile::Mail" do
|
|
151
151
|
|
152
152
|
context "to_s" do
|
153
153
|
it "should contain encoded subject" do
|
154
|
-
@mail.to_s.
|
154
|
+
expect(@mail.to_s).to match(Regexp.escape(sjis("=?Shift_JIS?B?lpyXdA==?=")))
|
155
155
|
end
|
156
156
|
|
157
157
|
it "should contain encoded body" do
|
158
|
-
@mail.to_s.
|
158
|
+
expect(@mail.to_s).to match(Regexp.escape(utf8_to_sjis("ほげ")))
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should contain encoded from" do
|
162
|
-
@mail.to_s.
|
162
|
+
expect(@mail.to_s).to match(sjis_regexp("gr+CzYLigtOC6Q=="))
|
163
163
|
end
|
164
164
|
|
165
165
|
it "should contain encoded to" do
|
166
|
-
@mail.to_s.
|
166
|
+
expect(@mail.to_s).to match(sjis_regexp("gt6Ct4LfgtOCs4LZgrk="))
|
167
167
|
end
|
168
168
|
|
169
169
|
it "should contains encoded emoticon" do
|
170
170
|
@mail.subject += ""
|
171
171
|
@mail.body = "#{@mail.body}"
|
172
172
|
|
173
|
-
@mail.to_s.
|
174
|
-
@mail.to_s.
|
173
|
+
expect(@mail.to_s).to match(Regexp.escape("=?Shift_JIS?B?lpyXdPmL?="))
|
174
|
+
expect(@mail.to_s).to match(sjis_regexp("\xf9\x8b"))
|
175
175
|
end
|
176
176
|
end
|
177
177
|
end
|
@@ -192,12 +192,12 @@ describe "Jpmobile::Mail" do
|
|
192
192
|
end
|
193
193
|
|
194
194
|
it "should contain encoded subject" do
|
195
|
-
@mail.to_s.
|
196
|
-
@mail.to_s.
|
197
|
-
@mail.to_s.
|
198
|
-
@mail.to_s.
|
199
|
-
@mail.to_s.
|
200
|
-
@mail.to_s.
|
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
|
|
@@ -209,12 +209,12 @@ describe "Jpmobile::Mail" do
|
|
209
209
|
end
|
210
210
|
|
211
211
|
it "should contain encoded subject" do
|
212
|
-
ascii_8bit(@mail.to_s).
|
213
|
-
ascii_8bit(@mail.to_s).
|
214
|
-
ascii_8bit(@mail.to_s).
|
215
|
-
ascii_8bit(@mail.to_s).
|
216
|
-
ascii_8bit(@mail.to_s).
|
217
|
-
ascii_8bit(@mail.to_s).
|
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
|
|
@@ -226,12 +226,12 @@ describe "Jpmobile::Mail" do
|
|
226
226
|
end
|
227
227
|
|
228
228
|
it "should contain encoded subject" do
|
229
|
-
@mail.to_s.
|
230
|
-
@mail.to_s.
|
231
|
-
@mail.to_s.
|
232
|
-
@mail.to_s.
|
233
|
-
@mail.to_s.
|
234
|
-
@mail.to_s.
|
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
|
|
@@ -244,12 +244,12 @@ describe "Jpmobile::Mail" do
|
|
244
244
|
|
245
245
|
context "to_s" do
|
246
246
|
it "should contain encoded subject" do
|
247
|
-
ascii_8bit(@mail.to_s).
|
248
|
-
ascii_8bit(@mail.to_s).
|
249
|
-
ascii_8bit(@mail.to_s).
|
250
|
-
ascii_8bit(@mail.to_s).
|
251
|
-
ascii_8bit(@mail.to_s).
|
252
|
-
ascii_8bit(@mail.to_s).
|
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
|
@@ -272,9 +272,9 @@ describe "Jpmobile::Mail" do
|
|
272
272
|
|
273
273
|
context "to_s" do
|
274
274
|
it "should contain encoded subject" do
|
275
|
-
ascii_8bit(@mail.to_s).
|
276
|
-
ascii_8bit(@mail.to_s).
|
277
|
-
ascii_8bit(@mail.to_s).
|
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
|
@@ -291,25 +291,25 @@ describe "Jpmobile::Mail" do
|
|
291
291
|
it "should encodes itself successfully" do
|
292
292
|
@mail.attachments['photo.jpg'] = @photo
|
293
293
|
|
294
|
-
|
294
|
+
expect {
|
295
295
|
@mail.to_s
|
296
|
-
}.
|
296
|
+
}.not_to raise_error
|
297
297
|
end
|
298
298
|
|
299
299
|
it "should encodes itself successfully with an inline attachment" do
|
300
300
|
@mail.attachments.inline['photo.jpg'] = @photo
|
301
301
|
|
302
|
-
|
302
|
+
expect {
|
303
303
|
@mail.to_s
|
304
|
-
}.
|
304
|
+
}.not_to raise_error
|
305
305
|
end
|
306
306
|
|
307
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 {
|
311
311
|
@mail.to_s
|
312
|
-
}.
|
312
|
+
}.not_to raise_error
|
313
313
|
end
|
314
314
|
end
|
315
315
|
|
@@ -324,13 +324,13 @@ describe "Jpmobile::Mail" do
|
|
324
324
|
it "wave dash converting correctly" do
|
325
325
|
@mail.body = '10:00〜12:00'
|
326
326
|
|
327
|
-
ascii_8bit(@mail.to_s).
|
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
330
|
it "full width tilde converting correctly" do
|
331
331
|
@mail.body = "10:00#{[0xff5e].pack("U")}12:00"
|
332
332
|
|
333
|
-
ascii_8bit(@mail.to_s).
|
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
|
|
@@ -343,9 +343,9 @@ describe "Jpmobile::Mail" do
|
|
343
343
|
|
344
344
|
it "delivers through SMTP" do
|
345
345
|
@mail.delivery_method :smtp, {:enable_starttls_auto => false}
|
346
|
-
|
346
|
+
expect {
|
347
347
|
@mail.deliver
|
348
|
-
}.
|
348
|
+
}.not_to raise_error
|
349
349
|
|
350
350
|
Mail::TestMailer.deliveries.size
|
351
351
|
end
|
@@ -367,7 +367,7 @@ describe "Jpmobile::Mail" do
|
|
367
367
|
@mail.mobile = mobile
|
368
368
|
@mail.from = '<えーゆー> au@ezweb.ne.jp'
|
369
369
|
|
370
|
-
@mail.encoded.
|
370
|
+
expect(@mail.encoded).to match(/content-transfer-encoding: 7bit/i)
|
371
371
|
end
|
372
372
|
|
373
373
|
it 'should not convert content-transfer-encoding with BINARY' do
|
@@ -382,8 +382,8 @@ describe "Jpmobile::Mail" do
|
|
382
382
|
@mail.mobile = mobile
|
383
383
|
@mail.from = '<えーゆー> au@ezweb.ne.jp'
|
384
384
|
|
385
|
-
@mail.encoded.
|
386
|
-
@mail.encoded.
|
385
|
+
expect(@mail.encoded).to match(/content-transfer-encoding: base64/i)
|
386
|
+
expect(@mail.encoded).to match(data)
|
387
387
|
end
|
388
388
|
end
|
389
389
|
end
|
@@ -5,30 +5,30 @@ describe Jpmobile::Mobile::Iphone do
|
|
5
5
|
describe 'iOS 4.0' do
|
6
6
|
it "unicode_emoticon? should be false" do
|
7
7
|
request = double('request')
|
8
|
-
request.
|
8
|
+
allow(request).to receive(:user_agent) {'Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_4 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8K2 Safari/6533.18.5'}
|
9
9
|
|
10
10
|
mobile = Jpmobile::Mobile::Iphone.new({}, request)
|
11
|
-
mobile.unicode_emoticon
|
11
|
+
expect(mobile.unicode_emoticon?).to be_falsey
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
describe 'iOS 5.0' do
|
16
16
|
it "unicode_emoticon? should be true" do
|
17
17
|
request = double('request')
|
18
|
-
request.
|
18
|
+
allow(request).to receive(:user_agent) {'Mozilla/5.0 (iPhone; CPU iPhone OS 5_1_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9B206 Safari/7534.48.3'}
|
19
19
|
|
20
20
|
mobile = Jpmobile::Mobile::Iphone.new({}, request)
|
21
|
-
mobile.unicode_emoticon
|
21
|
+
expect(mobile.unicode_emoticon?).to be_truthy
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe 'iOS 6.0' do
|
26
26
|
it "unicode_emoticon? should be true" do
|
27
27
|
request = double('request')
|
28
|
-
request.
|
28
|
+
allow(request).to receive(:user_agent) {'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25'}
|
29
29
|
|
30
30
|
mobile = Jpmobile::Mobile::Iphone.new({}, request)
|
31
|
-
mobile.unicode_emoticon
|
31
|
+
expect(mobile.unicode_emoticon?).to be_truthy
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|