|
11 | 11 |
|
12 | 12 | class EmailReplyParserTest < Test::Unit::TestCase |
13 | 13 | def test_encoding_should_be_maintained |
14 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_1_1.txt").to_s |
| 14 | + body = File.read EMAIL_FIXTURE_PATH.join("email_1_1.txt").to_s |
15 | 15 | EmailReplyParser.read body |
16 | 16 | reply = email(:email_1_1) |
17 | 17 | fragments = reply.fragments |
@@ -152,48 +152,48 @@ def test_returns_only_the_visible_fragments_as_a_string |
152 | 152 | end |
153 | 153 |
|
154 | 154 | def test_parse_out_just_top_for_outlook_reply |
155 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_2_1.txt").to_s |
| 155 | + body = File.read EMAIL_FIXTURE_PATH.join("email_2_1.txt").to_s |
156 | 156 | assert_equal "Outlook with a reply", EmailReplyParser.parse_reply(body) |
157 | 157 | end |
158 | 158 |
|
159 | 159 | def test_parse_out_just_top_for_outlook_with_reply_directly_above_line |
160 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_2_2.txt").to_s |
| 160 | + body = File.read EMAIL_FIXTURE_PATH.join("email_2_2.txt").to_s |
161 | 161 | assert_equal "Outlook with a reply directly above line", EmailReplyParser.parse_reply(body) |
162 | 162 | end |
163 | 163 |
|
164 | 164 | def test_parse_out_just_top_for_outlook_with_no_line |
165 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_2_3.txt").to_s |
| 165 | + body = File.read EMAIL_FIXTURE_PATH.join("email_2_3.txt").to_s |
166 | 166 | assert_equal "Outlook with a reply directly above line", EmailReplyParser.parse_reply(body) |
167 | 167 | end |
168 | 168 |
|
169 | 169 | def test_parse_out_sent_from_iPhone |
170 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_iPhone.txt").to_s |
| 170 | + body = File.read EMAIL_FIXTURE_PATH.join("email_iPhone.txt").to_s |
171 | 171 | assert_equal "Here is another email", EmailReplyParser.parse_reply(body) |
172 | 172 | end |
173 | 173 |
|
174 | 174 | def test_parse_out_sent_from_BlackBerry |
175 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_BlackBerry.txt").to_s |
| 175 | + body = File.read EMAIL_FIXTURE_PATH.join("email_BlackBerry.txt").to_s |
176 | 176 | assert_equal "Here is another email", EmailReplyParser.parse_reply(body) |
177 | 177 | end |
178 | 178 |
|
179 | 179 | def test_parse_out_send_from_multiword_mobile_device |
180 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_multi_word_sent_from_my_mobile_device.txt").to_s |
| 180 | + body = File.read EMAIL_FIXTURE_PATH.join("email_multi_word_sent_from_my_mobile_device.txt").to_s |
181 | 181 | assert_equal "Here is another email", EmailReplyParser.parse_reply(body) |
182 | 182 | end |
183 | 183 |
|
184 | 184 | def test_do_not_parse_out_send_from_in_regular_sentence |
185 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_sent_from_my_not_signature.txt").to_s |
| 185 | + body = File.read EMAIL_FIXTURE_PATH.join("email_sent_from_my_not_signature.txt").to_s |
186 | 186 | assert_equal "Here is another email\n\nSent from my desk, is much easier then my mobile phone.", EmailReplyParser.parse_reply(body) |
187 | 187 | end |
188 | 188 |
|
189 | 189 | def test_retains_bullets |
190 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_bullets.txt").to_s |
| 190 | + body = File.read EMAIL_FIXTURE_PATH.join("email_bullets.txt").to_s |
191 | 191 | assert_equal "test 2 this should list second\n\nand have spaces\n\nand retain this formatting\n\n\n - how about bullets\n - and another", |
192 | 192 | EmailReplyParser.parse_reply(body) |
193 | 193 | end |
194 | 194 |
|
195 | 195 | def test_parse_reply |
196 | | - body = IO.read EMAIL_FIXTURE_PATH.join("email_1_2.txt").to_s |
| 196 | + body = File.read EMAIL_FIXTURE_PATH.join("email_1_2.txt").to_s |
197 | 197 | assert_equal EmailReplyParser.read(body).visible_text, EmailReplyParser.parse_reply(body) |
198 | 198 | end |
199 | 199 |
|
@@ -230,7 +230,7 @@ def test_long_quote_processing_completes |
230 | 230 | end |
231 | 231 |
|
232 | 232 | def email(name) |
233 | | - body = IO.read EMAIL_FIXTURE_PATH.join("#{name}.txt").to_s |
| 233 | + body = File.read EMAIL_FIXTURE_PATH.join("#{name}.txt").to_s |
234 | 234 | EmailReplyParser.read body |
235 | 235 | end |
236 | 236 | end |
0 commit comments