maildown 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 793a913246a2706d4336913e23b351e8c255c3f3
4
- data.tar.gz: 0d5295b0a21a1e5d918af96c2ff3d0ed48ad5c3c
2
+ SHA256:
3
+ metadata.gz: 03e4be44fd6d8f2dfc2ea77c9a8043a26ba75948be6843d21c96ff0b5a79b597
4
+ data.tar.gz: ef13d877c6310a918f1f200f6a08d1b283552973e26606fc2b3e46ef6f2b1556
5
5
  SHA512:
6
- metadata.gz: 32c8aaeaeaa264b09bea442e80e80e5652c6f3b3eaeb22051841b17da1508ded3b020b2980c9dd059597e66f8a684e55f9d331b338d6ff4cd69d6903e9500d09
7
- data.tar.gz: 0bf4c6835f2e1b74f029eea5214e9ab00cc58d6dddc55b46ed51a8599d777ebe20916ca00c3d5b4f4c1f1557e63b6ea572b8982ec02c3eef466bebdfaaeceadc
6
+ metadata.gz: 61cb9dd93f18024cff25827f2106a012be77cdba0c1ce938a7213333c7c60432e38f92f778827f097bd7a92c1fb0295a65ed2dbe460b02091ec8c50a755ea01f
7
+ data.tar.gz: 2038ec28c9e60db0513ddb454f1dd6bac325d12655228259a39fa4db8cd25f2f4739c05eb8a9faaa364593a0ec8000803f8f7e4447b8ae09054a1d4ab8b2fb37
@@ -25,6 +25,8 @@ module Maildown
25
25
  @maildown_markdown_engine_text_block = block
26
26
  end
27
27
 
28
+ @maildown_markdown_engine_html_block = nil
29
+ @maildown_markdown_engine_text_block = nil
28
30
  def self.html_block
29
31
  @maildown_markdown_engine_html_block || default_html_block
30
32
  end
data/lib/maildown/md.rb CHANGED
@@ -8,6 +8,9 @@ module Maildown
8
8
  md_response = responses.detect {|r| r[:content_type] == Mime[:md].to_s }
9
9
  if md_response.present?
10
10
  @string = md_response[:body]
11
+ # Match beginning whitespace but not newline http://rubular.com/r/uCXQ58OOC8
12
+ @string.gsub!(/^[^\S\n]+/, ''.freeze) if Maildown.allow_indentation
13
+
11
14
  @responses.delete(md_response)
12
15
  end
13
16
  end
@@ -1,3 +1,3 @@
1
1
  module Maildown
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
data/lib/maildown.rb CHANGED
@@ -1,4 +1,13 @@
1
1
  module Maildown
2
+ @allow_indentations = false
3
+
4
+ def self.allow_indentation
5
+ @allow_indentations
6
+ end
7
+
8
+ def self.allow_indentation=(allow_indentations)
9
+ @allow_indentations = allow_indentations
10
+ end
2
11
  end
3
12
 
4
13
  require 'maildown/markdown_engine'
@@ -1,5 +1,5 @@
1
1
  # Set up gems listed in the Gemfile.
2
2
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
5
  $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -14,7 +14,7 @@ Dummy::Application.configure do
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
16
  config.serve_static_assets = true
17
- config.static_cache_control = "public, max-age=3600"
17
+ config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
18
18
 
19
19
  # Show full error reports and disable caching.
20
20
  config.consider_all_requests_local = true
@@ -1,140 +1,810 @@
1
-  (0.2ms) begin transaction
1
+ ---------------------------------------
2
+ MarkdownEngineTest: test_can_set_engine
3
+ ---------------------------------------
4
+ ----------------------------------------------------------
5
+ MarkdownEngineTest: test_default_works_in_multiple_threads
6
+ ----------------------------------------------------------
7
+ ----------------------------------------------------------------
8
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
9
+ ----------------------------------------------------------------
10
+ ----------------------------------------------
11
+ ExtActionMailerTest: test_monkeypatch_location
12
+ ----------------------------------------------
13
+ -------------------------------------------------------------
14
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
15
+ -------------------------------------------------------------
16
+ -----------------------------------------------------------
17
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
18
+ -----------------------------------------------------------
19
+ ------------------------------------
20
+ MaildownTest: test_no_md_in_response
21
+ ------------------------------------
22
+ ------------------------------------
23
+ MaildownTest: test_parse_md_response
24
+ ------------------------------------
25
+ ------------------------------------
26
+ MaildownTest: test_no_md_in_response
27
+ ------------------------------------
28
+ ------------------------------------
29
+ MaildownTest: test_parse_md_response
30
+ ------------------------------------
31
+ -----------------------------------------------------------
32
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
33
+ -----------------------------------------------------------
34
+ -------------------------------------------------------------
35
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
36
+ -------------------------------------------------------------
37
+ ----------------------------------------------
38
+ ExtActionMailerTest: test_monkeypatch_location
39
+ ----------------------------------------------
40
+ ----------------------------------------------------------
41
+ MarkdownEngineTest: test_default_works_in_multiple_threads
42
+ ----------------------------------------------------------
43
+ ---------------------------------------
44
+ MarkdownEngineTest: test_can_set_engine
45
+ ---------------------------------------
46
+ ----------------------------------------------------------------
47
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
48
+ ----------------------------------------------------------------
49
+ -----------------------------------------------------------
50
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
51
+ -----------------------------------------------------------
52
+ ----------------------------------------------
53
+ ExtActionMailerTest: test_monkeypatch_location
54
+ ----------------------------------------------
55
+ -------------------------------------------------------------
56
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
57
+ -------------------------------------------------------------
58
+ ---------------------------------------
59
+ MarkdownEngineTest: test_can_set_engine
60
+ ---------------------------------------
61
+ ----------------------------------------------------------------
62
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
63
+ ----------------------------------------------------------------
64
+ ----------------------------------------------------------
65
+ MarkdownEngineTest: test_default_works_in_multiple_threads
66
+ ----------------------------------------------------------
67
+ ------------------------------------
68
+ MaildownTest: test_no_md_in_response
69
+ ------------------------------------
70
+ ------------------------------------
71
+ MaildownTest: test_parse_md_response
72
+ ------------------------------------
73
+ -----------------------------------------------------------
74
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
75
+ -----------------------------------------------------------
76
+ -------------------------------------------------------------
77
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
78
+ -------------------------------------------------------------
79
+ ----------------------------------------------
80
+ ExtActionMailerTest: test_monkeypatch_location
81
+ ----------------------------------------------
82
+ ------------------------------------
83
+ MaildownTest: test_no_md_in_response
84
+ ------------------------------------
85
+ ------------------------------------
86
+ MaildownTest: test_parse_md_response
87
+ ------------------------------------
88
+ ---------------------------------------
89
+ MarkdownEngineTest: test_can_set_engine
90
+ ---------------------------------------
91
+ ----------------------------------------------------------------
92
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
93
+ ----------------------------------------------------------------
94
+ ----------------------------------------------------------
95
+ MarkdownEngineTest: test_default_works_in_multiple_threads
96
+ ----------------------------------------------------------
97
+ ----------------------------------------------------------------
98
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
99
+ ----------------------------------------------------------------
100
+ ----------------------------------------------------------
101
+ MarkdownEngineTest: test_default_works_in_multiple_threads
102
+ ----------------------------------------------------------
103
+ ---------------------------------------
104
+ MarkdownEngineTest: test_can_set_engine
105
+ ---------------------------------------
106
+ ------------------------------------
107
+ MaildownTest: test_no_md_in_response
108
+ ------------------------------------
109
+ ------------------------------------
110
+ MaildownTest: test_parse_md_response
111
+ ------------------------------------
112
+ -----------------------------------------------------------
113
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
114
+ -----------------------------------------------------------
115
+ -------------------------------------------------------------
116
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
117
+ -------------------------------------------------------------
118
+ ----------------------------------------------
119
+ ExtActionMailerTest: test_monkeypatch_location
120
+ ----------------------------------------------
121
+ ------------------------------------
122
+ MaildownTest: test_no_md_in_response
123
+ ------------------------------------
124
+ ------------------------------------
125
+ MaildownTest: test_parse_md_response
126
+ ------------------------------------
127
+ -----------------------------------------------------------
128
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
129
+ -----------------------------------------------------------
130
+ -------------------------------------------------------------
131
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
132
+ -------------------------------------------------------------
133
+ ----------------------------------------------
134
+ ExtActionMailerTest: test_monkeypatch_location
135
+ ----------------------------------------------
136
+ ---------------------------------------
137
+ MarkdownEngineTest: test_can_set_engine
138
+ ---------------------------------------
139
+ ----------------------------------------------------------
140
+ MarkdownEngineTest: test_default_works_in_multiple_threads
141
+ ----------------------------------------------------------
142
+ ----------------------------------------------------------------
143
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
144
+ ----------------------------------------------------------------
145
+ ---------------------------------------
146
+ MarkdownEngineTest: test_can_set_engine
147
+ ---------------------------------------
148
+ ----------------------------------------------------------
149
+ MarkdownEngineTest: test_default_works_in_multiple_threads
150
+ ----------------------------------------------------------
151
+ ----------------------------------------------------------------
152
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
153
+ ----------------------------------------------------------------
154
+ -------------------------------------------------------------
155
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
156
+ -------------------------------------------------------------
157
+ ----------------------------------------------
158
+ ExtActionMailerTest: test_monkeypatch_location
159
+ ----------------------------------------------
160
+ -----------------------------------------------------------
161
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
162
+ -----------------------------------------------------------
163
+ ------------------------------------
164
+ MaildownTest: test_no_md_in_response
165
+ ------------------------------------
166
+ ------------------------------------
167
+ MaildownTest: test_parse_md_response
168
+ ------------------------------------
169
+ ---------------------------------------
170
+ MarkdownEngineTest: test_can_set_engine
171
+ ---------------------------------------
172
+ ----------------------------------------------------------------
173
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
174
+ ----------------------------------------------------------------
175
+ ----------------------------------------------------------
176
+ MarkdownEngineTest: test_default_works_in_multiple_threads
177
+ ----------------------------------------------------------
178
+ -----------------------------------------------------------
179
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
180
+ -----------------------------------------------------------
181
+ -------------------------------------------------------------
182
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
183
+ -------------------------------------------------------------
184
+ ----------------------------------------------
185
+ ExtActionMailerTest: test_monkeypatch_location
186
+ ----------------------------------------------
187
+ ------------------------------------
188
+ MaildownTest: test_no_md_in_response
189
+ ------------------------------------
190
+ ------------------------------------
191
+ MaildownTest: test_parse_md_response
192
+ ------------------------------------
193
+ ------------------------------------
194
+ MaildownTest: test_no_md_in_response
195
+ ------------------------------------
196
+ ------------------------------------
197
+ MaildownTest: test_parse_md_response
198
+ ------------------------------------
199
+ -----------------------------------------------------------
200
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
201
+ -----------------------------------------------------------
202
+ -------------------------------------------------------------
203
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
204
+ -------------------------------------------------------------
205
+ ----------------------------------------------
206
+ ExtActionMailerTest: test_monkeypatch_location
207
+ ----------------------------------------------
208
+ ---------------------------------------
209
+ MarkdownEngineTest: test_can_set_engine
210
+ ---------------------------------------
211
+ ----------------------------------------------------------------
212
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
213
+ ----------------------------------------------------------------
214
+ ----------------------------------------------------------
215
+ MarkdownEngineTest: test_default_works_in_multiple_threads
216
+ ----------------------------------------------------------
217
+ ----------------------------------------------------------
218
+ MarkdownEngineTest: test_default_works_in_multiple_threads
219
+ ----------------------------------------------------------
220
+ ---------------------------------------
221
+ MarkdownEngineTest: test_can_set_engine
222
+ ---------------------------------------
223
+ ----------------------------------------------------------------
224
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
225
+ ----------------------------------------------------------------
226
+ ------------------------------------
227
+ MaildownTest: test_no_md_in_response
228
+ ------------------------------------
229
+ ------------------------------------
230
+ MaildownTest: test_parse_md_response
231
+ ------------------------------------
232
+ ----------------------------------------------
233
+ ExtActionMailerTest: test_monkeypatch_location
234
+ ----------------------------------------------
235
+ -----------------------------------------------------------
236
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
237
+ -----------------------------------------------------------
238
+ -------------------------------------------------------------
239
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
240
+ -------------------------------------------------------------
241
+ ---------------------------------------
242
+ MarkdownEngineTest: test_can_set_engine
243
+ ---------------------------------------
244
+ ----------------------------------------------------------------
245
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
246
+ ----------------------------------------------------------------
247
+ ----------------------------------------------------------
248
+ MarkdownEngineTest: test_default_works_in_multiple_threads
249
+ ----------------------------------------------------------
250
+ -----------------------------------------------------------
251
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
252
+ -----------------------------------------------------------
253
+ -------------------------------------------------------------
254
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
255
+ -------------------------------------------------------------
256
+ ----------------------------------------------
257
+ ExtActionMailerTest: test_monkeypatch_location
258
+ ----------------------------------------------
259
+ ------------------------------------
260
+ MaildownTest: test_no_md_in_response
261
+ ------------------------------------
262
+ ------------------------------------
263
+ MaildownTest: test_parse_md_response
264
+ ------------------------------------
265
+ ----------------------------------------------
266
+ ExtActionMailerTest: test_monkeypatch_location
267
+ ----------------------------------------------
268
+ -----------------------------------------------------------
269
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
270
+ -----------------------------------------------------------
271
+ -------------------------------------------------------------
272
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
273
+ -------------------------------------------------------------
274
+ ---------------------------------------
275
+ MarkdownEngineTest: test_can_set_engine
276
+ ---------------------------------------
277
+ ----------------------------------------------------------------
278
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
279
+ ----------------------------------------------------------------
280
+ ----------------------------------------------------------
281
+ MarkdownEngineTest: test_default_works_in_multiple_threads
282
+ ----------------------------------------------------------
283
+ ------------------------------------
284
+ MaildownTest: test_no_md_in_response
285
+ ------------------------------------
286
+ ------------------------------------
287
+ MaildownTest: test_parse_md_response
288
+ ------------------------------------
289
+ ----------------------------------------------
290
+ ExtActionMailerTest: test_monkeypatch_location
291
+ ----------------------------------------------
292
+ -------------------------------------------------------------
293
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
294
+ -------------------------------------------------------------
295
+ -----------------------------------------------------------
296
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
297
+ -----------------------------------------------------------
298
+ ----------------------------------------------------------------
299
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
300
+ ----------------------------------------------------------------
301
+ ---------------------------------------
302
+ MarkdownEngineTest: test_can_set_engine
303
+ ---------------------------------------
304
+ ----------------------------------------------------------
305
+ MarkdownEngineTest: test_default_works_in_multiple_threads
306
+ ----------------------------------------------------------
307
+ ------------------------------------
308
+ MaildownTest: test_no_md_in_response
309
+ ------------------------------------
310
+ ------------------------------------
311
+ MaildownTest: test_parse_md_response
312
+ ------------------------------------
313
+ -----------------------------------------------------------
314
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
315
+ -----------------------------------------------------------
316
+ -------------------------------------------------------------
317
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
318
+ -------------------------------------------------------------
319
+ ----------------------------------------------
320
+ ExtActionMailerTest: test_monkeypatch_location
321
+ ----------------------------------------------
322
+ ------------------------------------
323
+ MaildownTest: test_no_md_in_response
324
+ ------------------------------------
325
+ ------------------------------------
326
+ MaildownTest: test_parse_md_response
327
+ ------------------------------------
328
+ ----------------------------------------------------------
329
+ MarkdownEngineTest: test_default_works_in_multiple_threads
330
+ ----------------------------------------------------------
331
+ ---------------------------------------
332
+ MarkdownEngineTest: test_can_set_engine
333
+ ---------------------------------------
334
+ ----------------------------------------------------------------
335
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
336
+ ----------------------------------------------------------------
337
+ -------------------------------------------------------------
338
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
339
+ -------------------------------------------------------------
340
+ ----------------------------------------------
341
+ ExtActionMailerTest: test_monkeypatch_location
342
+ ----------------------------------------------
343
+ -----------------------------------------------------------
344
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
345
+ -----------------------------------------------------------
346
+ ----------------------------------------------------------
347
+ MarkdownEngineTest: test_default_works_in_multiple_threads
348
+ ----------------------------------------------------------
349
+ ---------------------------------------
350
+ MarkdownEngineTest: test_can_set_engine
351
+ ---------------------------------------
352
+ ----------------------------------------------------------------
353
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
354
+ ----------------------------------------------------------------
355
+ ------------------------------------
356
+ MaildownTest: test_parse_md_response
357
+ ------------------------------------
358
+ ------------------------------------
359
+ MaildownTest: test_no_md_in_response
360
+ ------------------------------------
361
+ -------------------------------------------------------------
362
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
363
+ -------------------------------------------------------------
364
+ ----------------------------------------------
365
+ ExtActionMailerTest: test_monkeypatch_location
366
+ ----------------------------------------------
367
+ -----------------------------------------------------------
368
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
369
+ -----------------------------------------------------------
370
+ ----------------------------------------------------------------
371
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
372
+ ----------------------------------------------------------------
373
+ ------------------------------------------
374
+ MarkdownEngineTest: test_allow_indentation
375
+ ------------------------------------------
376
+ ---------------------------------------
377
+ MarkdownEngineTest: test_can_set_engine
378
+ ---------------------------------------
379
+ ----------------------------------------------------------
380
+ MarkdownEngineTest: test_default_works_in_multiple_threads
381
+ ----------------------------------------------------------
382
+ ------------------------------------
383
+ MaildownTest: test_no_md_in_response
384
+ ------------------------------------
385
+ ------------------------------------
386
+ MaildownTest: test_parse_md_response
387
+ ------------------------------------
388
+ -------------------------------------------------------------
389
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
390
+ -------------------------------------------------------------
2
391
  -----------------------------------------------------------
3
392
  ExtActionMailerTest: test_correctly_registered_md_mime_type
4
393
  -----------------------------------------------------------
5
-  (0.1ms) rollback transaction
6
-  (0.1ms) begin transaction
394
+ ----------------------------------------------
395
+ ExtActionMailerTest: test_monkeypatch_location
396
+ ----------------------------------------------
397
+ ------------------------------------
398
+ MaildownTest: test_no_md_in_response
399
+ ------------------------------------
400
+ ------------------------------------
401
+ MaildownTest: test_parse_md_response
402
+ ------------------------------------
403
+ ------------------------------------------
404
+ MarkdownEngineTest: test_allow_indentation
405
+ ------------------------------------------
406
+ ---------------------------------------
407
+ MarkdownEngineTest: test_can_set_engine
408
+ ---------------------------------------
409
+ ----------------------------------------------------------------
410
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
411
+ ----------------------------------------------------------------
412
+ ----------------------------------------------------------
413
+ MarkdownEngineTest: test_default_works_in_multiple_threads
414
+ ----------------------------------------------------------
415
+ ------------------------------------------
416
+ MarkdownEngineTest: test_allow_indentation
417
+ ------------------------------------------
418
+ ---------------------------------------
419
+ MarkdownEngineTest: test_can_set_engine
420
+ ---------------------------------------
421
+ ----------------------------------------------------------------
422
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
423
+ ----------------------------------------------------------------
424
+ ----------------------------------------------------------
425
+ MarkdownEngineTest: test_default_works_in_multiple_threads
426
+ ----------------------------------------------------------
427
+ ------------------------------------
428
+ MaildownTest: test_no_md_in_response
429
+ ------------------------------------
430
+ ------------------------------------
431
+ MaildownTest: test_parse_md_response
432
+ ------------------------------------
7
433
  -------------------------------------------------------------
8
434
  ExtActionMailerTest: test_default_types_on_action_mailer_base
9
435
  -------------------------------------------------------------
10
-  (0.2ms) rollback transaction
11
-  (0.8ms) begin transaction
12
436
  ----------------------------------------------
13
437
  ExtActionMailerTest: test_monkeypatch_location
14
438
  ----------------------------------------------
15
-  (0.3ms) rollback transaction
16
-  (0.2ms) begin transaction
439
+ -----------------------------------------------------------
440
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
441
+ -----------------------------------------------------------
17
442
  ------------------------------------
18
443
  MaildownTest: test_no_md_in_response
19
444
  ------------------------------------
20
-  (0.1ms) rollback transaction
21
-  (0.1ms) begin transaction
22
445
  ------------------------------------
23
446
  MaildownTest: test_parse_md_response
24
447
  ------------------------------------
25
-  (0.1ms) rollback transaction
26
-  (0.1ms) begin transaction
27
448
  ---------------------------------------
28
449
  MarkdownEngineTest: test_can_set_engine
29
450
  ---------------------------------------
30
-  (0.1ms) rollback transaction
31
-  (0.2ms) begin transaction
451
+ ----------------------------------------------------------------
452
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
453
+ ----------------------------------------------------------------
32
454
  ----------------------------------------------------------
33
455
  MarkdownEngineTest: test_default_works_in_multiple_threads
34
456
  ----------------------------------------------------------
35
-  (0.2ms) rollback transaction
36
-  (0.1ms) begin transaction
457
+ -------------------------------------------------------------
458
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
459
+ -------------------------------------------------------------
460
+ -----------------------------------------------------------
461
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
462
+ -----------------------------------------------------------
463
+ ----------------------------------------------
464
+ ExtActionMailerTest: test_monkeypatch_location
465
+ ----------------------------------------------
466
+ ------------------------------------
467
+ MaildownTest: test_parse_md_response
468
+ ------------------------------------
469
+ ------------------------
470
+ MaildownTest: test_blerg
471
+ ------------------------
472
+ ------------------------------------
473
+ MaildownTest: test_no_md_in_response
474
+ ------------------------------------
475
+ -------------------------------------------------------------
476
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
477
+ -------------------------------------------------------------
478
+ ----------------------------------------------
479
+ ExtActionMailerTest: test_monkeypatch_location
480
+ ----------------------------------------------
37
481
  -----------------------------------------------------------
38
482
  ExtActionMailerTest: test_correctly_registered_md_mime_type
39
483
  -----------------------------------------------------------
40
-  (0.0ms) rollback transaction
41
-  (0.1ms) begin transaction
484
+ ---------------------------------------
485
+ MarkdownEngineTest: test_can_set_engine
486
+ ---------------------------------------
487
+ ----------------------------------------------------------------
488
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
489
+ ----------------------------------------------------------------
490
+ ----------------------------------------------------------
491
+ MarkdownEngineTest: test_default_works_in_multiple_threads
492
+ ----------------------------------------------------------
493
+ ---------------------------------------
494
+ MarkdownEngineTest: test_can_set_engine
495
+ ---------------------------------------
496
+ ----------------------------------------------------------------
497
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
498
+ ----------------------------------------------------------------
499
+ ----------------------------------------------------------
500
+ MarkdownEngineTest: test_default_works_in_multiple_threads
501
+ ----------------------------------------------------------
502
+ ------------------------------------
503
+ MaildownTest: test_parse_md_response
504
+ ------------------------------------
505
+ ------------------------
506
+ MaildownTest: test_blerg
507
+ ------------------------
508
+ ------------------------------------
509
+ MaildownTest: test_no_md_in_response
510
+ ------------------------------------
42
511
  -------------------------------------------------------------
43
512
  ExtActionMailerTest: test_default_types_on_action_mailer_base
44
513
  -------------------------------------------------------------
45
-  (0.0ms) rollback transaction
46
-  (0.0ms) begin transaction
514
+ -----------------------------------------------------------
515
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
516
+ -----------------------------------------------------------
47
517
  ----------------------------------------------
48
518
  ExtActionMailerTest: test_monkeypatch_location
49
519
  ----------------------------------------------
50
-  (0.0ms) rollback transaction
51
-  (0.0ms) begin transaction
52
520
  ---------------------------------------
53
521
  MarkdownEngineTest: test_can_set_engine
54
522
  ---------------------------------------
55
-  (0.0ms) rollback transaction
56
-  (0.1ms) begin transaction
523
+ ----------------------------------------------------------------
524
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
525
+ ----------------------------------------------------------------
57
526
  ----------------------------------------------------------
58
527
  MarkdownEngineTest: test_default_works_in_multiple_threads
59
528
  ----------------------------------------------------------
60
-  (0.1ms) rollback transaction
61
-  (0.0ms) begin transaction
529
+ ------------------------
530
+ MaildownTest: test_blerg
531
+ ------------------------
62
532
  ------------------------------------
63
533
  MaildownTest: test_no_md_in_response
64
534
  ------------------------------------
65
-  (0.0ms) rollback transaction
66
-  (0.0ms) begin transaction
67
535
  ------------------------------------
68
536
  MaildownTest: test_parse_md_response
69
537
  ------------------------------------
70
-  (0.1ms) rollback transaction
71
-  (0.1ms) begin transaction
538
+ -----------------------------------------------------------
539
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
540
+ -----------------------------------------------------------
541
+ -------------------------------------------------------------
542
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
543
+ -------------------------------------------------------------
544
+ ----------------------------------------------
545
+ ExtActionMailerTest: test_monkeypatch_location
546
+ ----------------------------------------------
547
+ -------------------------------------------------------------
548
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
549
+ -------------------------------------------------------------
550
+ -----------------------------------------------------------
551
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
552
+ -----------------------------------------------------------
553
+ ----------------------------------------------
554
+ ExtActionMailerTest: test_monkeypatch_location
555
+ ----------------------------------------------
556
+ ------------------------------------
557
+ MaildownTest: test_parse_md_response
558
+ ------------------------------------
559
+ ------------------------------------
560
+ MaildownTest: test_no_md_in_response
561
+ ------------------------------------
562
+ ------------------------
563
+ MaildownTest: test_blerg
564
+ ------------------------
565
+ ---------------------------------------
566
+ MarkdownEngineTest: test_can_set_engine
567
+ ---------------------------------------
568
+ ----------------------------------------------------------
569
+ MarkdownEngineTest: test_default_works_in_multiple_threads
570
+ ----------------------------------------------------------
571
+ ----------------------------------------------------------------
572
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
573
+ ----------------------------------------------------------------
574
+ -----------------------------------------------------------
575
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
576
+ -----------------------------------------------------------
577
+ -------------------------------------------------------------
578
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
579
+ -------------------------------------------------------------
580
+ ----------------------------------------------
581
+ ExtActionMailerTest: test_monkeypatch_location
582
+ ----------------------------------------------
583
+ ----------------------------------------------------------------
584
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
585
+ ----------------------------------------------------------------
586
+ ----------------------------------------------------------
587
+ MarkdownEngineTest: test_default_works_in_multiple_threads
588
+ ----------------------------------------------------------
589
+ ---------------------------------------
590
+ MarkdownEngineTest: test_can_set_engine
591
+ ---------------------------------------
592
+ ------------------------
593
+ MaildownTest: test_blerg
594
+ ------------------------
72
595
  ------------------------------------
73
596
  MaildownTest: test_no_md_in_response
74
597
  ------------------------------------
75
-  (0.1ms) rollback transaction
76
-  (0.0ms) begin transaction
77
598
  ------------------------------------
78
599
  MaildownTest: test_parse_md_response
79
600
  ------------------------------------
80
-  (0.1ms) rollback transaction
81
-  (0.1ms) begin transaction
601
+ ----------------------------------------------------------------
602
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
603
+ ----------------------------------------------------------------
604
+ ---------------------------------------
605
+ MarkdownEngineTest: test_can_set_engine
606
+ ---------------------------------------
607
+ ----------------------------------------------------------
608
+ MarkdownEngineTest: test_default_works_in_multiple_threads
609
+ ----------------------------------------------------------
82
610
  -----------------------------------------------------------
83
611
  ExtActionMailerTest: test_correctly_registered_md_mime_type
84
612
  -----------------------------------------------------------
85
-  (0.1ms) rollback transaction
86
-  (0.1ms) begin transaction
87
613
  -------------------------------------------------------------
88
614
  ExtActionMailerTest: test_default_types_on_action_mailer_base
89
615
  -------------------------------------------------------------
90
-  (0.1ms) rollback transaction
91
-  (0.1ms) begin transaction
92
616
  ----------------------------------------------
93
617
  ExtActionMailerTest: test_monkeypatch_location
94
618
  ----------------------------------------------
95
-  (0.0ms) rollback transaction
96
-  (0.0ms) begin transaction
619
+ --------------------------------------------------------------
620
+ MaildownTest: test_allow_indentation_strips_leading_whitespace
621
+ --------------------------------------------------------------
622
+ ------------------------------------
623
+ MaildownTest: test_no_md_in_response
624
+ ------------------------------------
625
+ --------------------------------------------------------
626
+ MaildownTest: test_whitespace_is_not_stripped_by_default
627
+ --------------------------------------------------------
628
+ ------------------------------------
629
+ MaildownTest: test_parse_md_response
630
+ ------------------------------------
631
+ ----------------------------------------------
632
+ ExtActionMailerTest: test_monkeypatch_location
633
+ ----------------------------------------------
634
+ -----------------------------------------------------------
635
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
636
+ -----------------------------------------------------------
637
+ -------------------------------------------------------------
638
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
639
+ -------------------------------------------------------------
97
640
  ---------------------------------------
98
641
  MarkdownEngineTest: test_can_set_engine
99
642
  ---------------------------------------
100
-  (0.0ms) rollback transaction
101
-  (0.1ms) begin transaction
643
+ ----------------------------------------------------------------
644
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
645
+ ----------------------------------------------------------------
102
646
  ----------------------------------------------------------
103
647
  MarkdownEngineTest: test_default_works_in_multiple_threads
104
648
  ----------------------------------------------------------
105
-  (0.0ms) rollback transaction
106
-  (0.1ms) begin transaction
649
+ ------------------------------------
650
+ MaildownTest: test_no_md_in_response
651
+ ------------------------------------
652
+ --------------------------------------------------------------
653
+ MaildownTest: test_allow_indentation_strips_leading_whitespace
654
+ --------------------------------------------------------------
655
+ --------------------------------------------------------
656
+ MaildownTest: test_whitespace_is_not_stripped_by_default
657
+ --------------------------------------------------------
658
+ ------------------------------------
659
+ MaildownTest: test_parse_md_response
660
+ ------------------------------------
107
661
  ---------------------------------------
108
662
  MarkdownEngineTest: test_can_set_engine
109
663
  ---------------------------------------
110
-  (0.1ms) rollback transaction
111
-  (0.1ms) begin transaction
664
+ ----------------------------------------------------------------
665
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
666
+ ----------------------------------------------------------------
667
+ ----------------------------------------------------------
668
+ MarkdownEngineTest: test_default_works_in_multiple_threads
669
+ ----------------------------------------------------------
670
+ ----------------------------------------------
671
+ ExtActionMailerTest: test_monkeypatch_location
672
+ ----------------------------------------------
673
+ -----------------------------------------------------------
674
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
675
+ -----------------------------------------------------------
676
+ -------------------------------------------------------------
677
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
678
+ -------------------------------------------------------------
679
+ --------------------------------------------------------------
680
+ MaildownTest: test_allow_indentation_strips_leading_whitespace
681
+ --------------------------------------------------------------
682
+ ------------------------------------
683
+ MaildownTest: test_parse_md_response
684
+ ------------------------------------
685
+ ------------------------------------
686
+ MaildownTest: test_no_md_in_response
687
+ ------------------------------------
688
+ --------------------------------------------------------
689
+ MaildownTest: test_whitespace_is_not_stripped_by_default
690
+ --------------------------------------------------------
691
+ ----------------------------------------------------------------
692
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
693
+ ----------------------------------------------------------------
112
694
  ----------------------------------------------------------
113
695
  MarkdownEngineTest: test_default_works_in_multiple_threads
114
696
  ----------------------------------------------------------
115
-  (0.1ms) rollback transaction
116
-  (0.1ms) begin transaction
697
+ ---------------------------------------
698
+ MarkdownEngineTest: test_can_set_engine
699
+ ---------------------------------------
700
+ ------------------------------------
701
+ MaildownTest: test_parse_md_response
702
+ ------------------------------------
703
+ --------------------------------------------------------------
704
+ MaildownTest: test_allow_indentation_strips_leading_whitespace
705
+ --------------------------------------------------------------
706
+ ------------------------------------
707
+ MaildownTest: test_no_md_in_response
708
+ ------------------------------------
709
+ --------------------------------------------------------
710
+ MaildownTest: test_whitespace_is_not_stripped_by_default
711
+ --------------------------------------------------------
712
+ -----------------------------------------------------------
713
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
714
+ -----------------------------------------------------------
715
+ -------------------------------------------------------------
716
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
717
+ -------------------------------------------------------------
718
+ ----------------------------------------------
719
+ ExtActionMailerTest: test_monkeypatch_location
720
+ ----------------------------------------------
721
+ --------------------------------------------------------------
722
+ MaildownTest: test_allow_indentation_strips_leading_whitespace
723
+ --------------------------------------------------------------
117
724
  ------------------------------------
118
725
  MaildownTest: test_no_md_in_response
119
726
  ------------------------------------
120
-  (0.0ms) rollback transaction
121
-  (0.1ms) begin transaction
122
727
  ------------------------------------
123
728
  MaildownTest: test_parse_md_response
124
729
  ------------------------------------
125
-  (0.1ms) rollback transaction
126
-  (0.1ms) begin transaction
730
+ --------------------------------------------------------
731
+ MaildownTest: test_whitespace_is_not_stripped_by_default
732
+ --------------------------------------------------------
733
+ ----------------------------------------------
734
+ ExtActionMailerTest: test_monkeypatch_location
735
+ ----------------------------------------------
736
+ -----------------------------------------------------------
737
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
738
+ -----------------------------------------------------------
739
+ -------------------------------------------------------------
740
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
741
+ -------------------------------------------------------------
742
+ ---------------------------------------
743
+ MarkdownEngineTest: test_can_set_engine
744
+ ---------------------------------------
745
+ ----------------------------------------------------------
746
+ MarkdownEngineTest: test_default_works_in_multiple_threads
747
+ ----------------------------------------------------------
748
+ ----------------------------------------------------------------
749
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
750
+ ----------------------------------------------------------------
751
+ ----------------------------------------------
752
+ ExtActionMailerTest: test_monkeypatch_location
753
+ ----------------------------------------------
754
+ -----------------------------------------------------------
755
+ ExtActionMailerTest: test_correctly_registered_md_mime_type
756
+ -----------------------------------------------------------
757
+ -------------------------------------------------------------
758
+ ExtActionMailerTest: test_default_types_on_action_mailer_base
759
+ -------------------------------------------------------------
760
+ ------------------------------------
761
+ MaildownTest: test_parse_md_response
762
+ ------------------------------------
763
+ --------------------------------------------------------
764
+ MaildownTest: test_whitespace_is_not_stripped_by_default
765
+ --------------------------------------------------------
766
+ --------------------------------------------------------------
767
+ MaildownTest: test_allow_indentation_strips_leading_whitespace
768
+ --------------------------------------------------------------
769
+ ------------------------------------
770
+ MaildownTest: test_no_md_in_response
771
+ ------------------------------------
772
+ ---------------------------------------
773
+ MarkdownEngineTest: test_can_set_engine
774
+ ---------------------------------------
775
+ ----------------------------------------------------------
776
+ MarkdownEngineTest: test_default_works_in_multiple_threads
777
+ ----------------------------------------------------------
778
+ ----------------------------------------------------------------
779
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
780
+ ----------------------------------------------------------------
127
781
  -----------------------------------------------------------
128
782
  ExtActionMailerTest: test_correctly_registered_md_mime_type
129
783
  -----------------------------------------------------------
130
-  (0.0ms) rollback transaction
131
-  (0.0ms) begin transaction
132
784
  -------------------------------------------------------------
133
785
  ExtActionMailerTest: test_default_types_on_action_mailer_base
134
786
  -------------------------------------------------------------
135
-  (0.0ms) rollback transaction
136
-  (0.1ms) begin transaction
137
787
  ----------------------------------------------
138
788
  ExtActionMailerTest: test_monkeypatch_location
139
789
  ----------------------------------------------
140
-  (0.0ms) rollback transaction
790
+ --------------------------------------------------------------
791
+ MaildownTest: test_allow_indentation_strips_leading_whitespace
792
+ --------------------------------------------------------------
793
+ ------------------------------------
794
+ MaildownTest: test_no_md_in_response
795
+ ------------------------------------
796
+ ------------------------------------
797
+ MaildownTest: test_parse_md_response
798
+ ------------------------------------
799
+ --------------------------------------------------------
800
+ MaildownTest: test_whitespace_is_not_stripped_by_default
801
+ --------------------------------------------------------
802
+ ---------------------------------------
803
+ MarkdownEngineTest: test_can_set_engine
804
+ ---------------------------------------
805
+ ----------------------------------------------------------------
806
+ MarkdownEngineTest: test_custom_engine_works_in_multiple_threads
807
+ ----------------------------------------------------------------
808
+ ----------------------------------------------------------
809
+ MarkdownEngineTest: test_default_works_in_multiple_threads
810
+ ----------------------------------------------------------
data/test/test_helper.rb CHANGED
@@ -15,16 +15,30 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
15
15
  # ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
16
16
  # end
17
17
 
18
+
19
+ def default_body
20
+ "Hi,\n\n##\n\n\nName:\n test_to_yaml_with_time_with_zone_should_not_raise_exception\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L7\nName:\n test_roundtrip\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L20\nName:\n test_roundtrip_serialized_column\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L27\nName:\n test_encode_with_coder\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L32\nName:\n test_psych_roundtrip\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L39\nName:\n test_psych_roundtrip_new_object\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L46\n\n--\n@schneems\n"
21
+ end
22
+
18
23
  def orig_text_response
19
- {:body=>"Hi,\n\n##\n\n\nName:\n test_to_yaml_with_time_with_zone_should_not_raise_exception\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L7\nName:\n test_roundtrip\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L20\nName:\n test_roundtrip_serialized_column\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L27\nName:\n test_encode_with_coder\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L32\nName:\n test_psych_roundtrip\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L39\nName:\n test_psych_roundtrip_new_object\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L46\n\n--\n@schneems\n", :content_type=>"text/plain"}.dup
24
+ {
25
+ :body => default_body,
26
+ :content_type => "text/plain"
27
+ }.dup
20
28
  end
21
29
 
22
30
  def orig_html_response
23
- {:body=>"Hi,\n\n##\n\n\nName:\n test_to_yaml_with_time_with_zone_should_not_raise_exception\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L7\nName:\n test_roundtrip\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L20\nName:\n test_roundtrip_serialized_column\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L27\nName:\n test_encode_with_coder\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L32\nName:\n test_psych_roundtrip\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L39\nName:\n test_psych_roundtrip_new_object\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L46\n\n--\n@schneems\n", :content_type=>"text/html"}.dup
31
+ {
32
+ :body => default_body,
33
+ :content_type => "text/html"
34
+ }.dup
24
35
  end
25
36
 
26
37
  def md_response
27
- {:body=>"Hi,\n\n##\n\n\nName:\n test_to_yaml_with_time_with_zone_should_not_raise_exception\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L7\nName:\n test_roundtrip\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L20\nName:\n test_roundtrip_serialized_column\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L27\nName:\n test_encode_with_coder\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L32\nName:\n test_psych_roundtrip\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L39\nName:\n test_psych_roundtrip_new_object\nLocation:\n https://github.com/rails/rails/blob/master/test/cases/yaml_serialization_test.rb/#L46\n\n--\n@schneems\n", :content_type=>"text/md"}.dup
38
+ {
39
+ :body => default_body,
40
+ :content_type => "text/md"
41
+ }.dup
28
42
  end
29
43
 
30
44
  def full_responses
@@ -32,7 +46,27 @@ def full_responses
32
46
  end
33
47
 
34
48
  def parsed_html_response
35
- {body: Kramdown::Document.new(orig_text_response[:body]).to_html, content_type: "text/html"}
49
+ {
50
+ body: Kramdown::Document.new(orig_text_response[:body]).to_html,
51
+ content_type: "text/html"
52
+ }
53
+ end
54
+
55
+ def string_to_response_array(string)
56
+ [
57
+ {
58
+ body: string,
59
+ content_type: "text/plain"
60
+ }.dup,
61
+ {
62
+ body: string,
63
+ content_type: "text/html"
64
+ }.dup,
65
+ {
66
+ body: string,
67
+ content_type: "text/md"
68
+ }.dup,
69
+ ]
36
70
  end
37
71
 
38
72
  def parses_responses
@@ -3,12 +3,11 @@ require 'test_helper'
3
3
  class ExtActionMailerTest < ActiveSupport::TestCase
4
4
 
5
5
  test "correctly registered md mime type" do
6
- assert_equal Mime::MD, Mime::Type.lookup("text/md")
7
- assert_equal "text/md", Mime::MD.to_s
6
+ assert_equal Mime[:md], Mime::Type.lookup("text/md")
7
+ assert_equal "text/md", Mime[:md].to_s
8
8
  end
9
9
 
10
10
  test "default types on action mailer base" do
11
- expected = [:html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip, :md]
12
11
  actual = ActionMailer::Base.view_context_class.default_formats
13
12
  assert_equal actual.include?(:md), true, "Expected #{actual.inspect} to include :md but it did not"
14
13
  end
@@ -7,6 +7,47 @@ class MaildownTest < ActiveSupport::TestCase
7
7
  assert_equal parses_responses, md.to_responses
8
8
  end
9
9
 
10
+
11
+ test "allow indentation strips leading whitespace" do
12
+ begin
13
+ Maildown.allow_indentation = true
14
+
15
+ string = "foo"
16
+
17
+ md = ::Maildown::Md.new(string_to_response_array("\n #{string}"))
18
+ assert md.contains_md?
19
+
20
+ expected = [{
21
+ body: "\n#{string}",
22
+ content_type: "text/plain"
23
+ },
24
+ {
25
+ body: "\n<p>#{string}</p>\n",
26
+ content_type: "text/html"
27
+ }]
28
+ assert_equal expected, md.to_responses
29
+ ensure
30
+ Maildown.allow_indentation = false
31
+ end
32
+ end
33
+
34
+ test "whitespace is not stripped by default" do
35
+ string = "foo"
36
+
37
+ md = ::Maildown::Md.new(string_to_response_array(" #{string}"))
38
+ assert md.contains_md?
39
+
40
+ expected = [{
41
+ body: " #{string}",
42
+ content_type: "text/plain"
43
+ },
44
+ {
45
+ body: "<pre><code>foo\n</code></pre>\n",
46
+ content_type: "text/html"
47
+ }]
48
+ assert_equal expected, md.to_responses
49
+ end
50
+
10
51
  test "no md in response" do
11
52
  md = ::Maildown::Md.new([])
12
53
  refute md.contains_md?
@@ -3,15 +3,15 @@ require 'test_helper'
3
3
  class MarkdownEngineTest < ActiveSupport::TestCase
4
4
 
5
5
  def setup
6
- @default_setup = Maildown::MarkdownEngine.block
6
+ @default_setup = Maildown::MarkdownEngine.html_block
7
7
  end
8
8
 
9
9
  def teardown
10
- Maildown::MarkdownEngine.set(&@default_setup)
10
+ Maildown::MarkdownEngine.set_html(&@default_setup)
11
11
  end
12
12
 
13
13
  test "can set engine" do
14
- Maildown::MarkdownEngine.set do |text|
14
+ Maildown::MarkdownEngine.set_html do |text|
15
15
  "foo: #{text}"
16
16
  end
17
17
  assert_equal "foo: bar", Maildown::MarkdownEngine.to_html("bar")
@@ -25,7 +25,7 @@ class MarkdownEngineTest < ActiveSupport::TestCase
25
25
  end
26
26
 
27
27
  test "custom engine works in multiple threads" do
28
- Maildown::MarkdownEngine.set do |text|
28
+ Maildown::MarkdownEngine.set_html do |text|
29
29
  "foo: #{text}"
30
30
  end
31
31
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maildown
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - schneems
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-08 00:00:00.000000000 Z
11
+ date: 2018-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -123,7 +123,6 @@ files:
123
123
  - test/dummy/config/initializers/wrap_parameters.rb
124
124
  - test/dummy/config/locales/en.yml
125
125
  - test/dummy/config/routes.rb
126
- - test/dummy/db/test.sqlite3
127
126
  - test/dummy/log/test.log
128
127
  - test/dummy/public/404.html
129
128
  - test/dummy/public/422.html
@@ -153,45 +152,44 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
152
  version: '0'
154
153
  requirements: []
155
154
  rubyforge_project:
156
- rubygems_version: 2.5.2
155
+ rubygems_version: 2.7.3
157
156
  signing_key:
158
157
  specification_version: 4
159
158
  summary: Markdown in your mailbox
160
159
  test_files:
160
+ - test/unit/ext_action_mailer_test.rb
161
+ - test/unit/maildown_test.rb
162
+ - test/unit/markdown_engine_test.rb
163
+ - test/dummy/app/controllers/application_controller.rb
164
+ - test/dummy/app/views/layouts/application.html.erb
161
165
  - test/dummy/app/assets/javascripts/application.js
162
166
  - test/dummy/app/assets/stylesheets/application.css
163
- - test/dummy/app/controllers/application_controller.rb
164
167
  - test/dummy/app/helpers/application_helper.rb
165
- - test/dummy/app/views/layouts/application.html.erb
168
+ - test/dummy/bin/rake
166
169
  - test/dummy/bin/bundle
167
170
  - test/dummy/bin/rails
168
- - test/dummy/bin/rake
169
- - test/dummy/config/application.rb
170
- - test/dummy/config/boot.rb
171
- - test/dummy/config/database.yml
172
- - test/dummy/config/environment.rb
173
- - test/dummy/config/environments/development.rb
171
+ - test/dummy/config/routes.rb
172
+ - test/dummy/config/locales/en.yml
174
173
  - test/dummy/config/environments/production.rb
174
+ - test/dummy/config/environments/development.rb
175
175
  - test/dummy/config/environments/test.rb
176
+ - test/dummy/config/environment.rb
177
+ - test/dummy/config/application.rb
178
+ - test/dummy/config/database.yml
179
+ - test/dummy/config/boot.rb
176
180
  - test/dummy/config/initializers/backtrace_silencers.rb
177
- - test/dummy/config/initializers/filter_parameter_logging.rb
178
- - test/dummy/config/initializers/inflections.rb
179
181
  - test/dummy/config/initializers/mime_types.rb
180
- - test/dummy/config/initializers/secret_token.rb
182
+ - test/dummy/config/initializers/filter_parameter_logging.rb
181
183
  - test/dummy/config/initializers/session_store.rb
182
184
  - test/dummy/config/initializers/wrap_parameters.rb
183
- - test/dummy/config/locales/en.yml
184
- - test/dummy/config/routes.rb
185
+ - test/dummy/config/initializers/secret_token.rb
186
+ - test/dummy/config/initializers/inflections.rb
185
187
  - test/dummy/config.ru
186
- - test/dummy/db/test.sqlite3
187
- - test/dummy/log/test.log
188
- - test/dummy/public/404.html
188
+ - test/dummy/Rakefile
189
+ - test/dummy/public/favicon.ico
189
190
  - test/dummy/public/422.html
190
191
  - test/dummy/public/500.html
191
- - test/dummy/public/favicon.ico
192
- - test/dummy/Rakefile
192
+ - test/dummy/public/404.html
193
+ - test/dummy/log/test.log
193
194
  - test/dummy/README.rdoc
194
195
  - test/test_helper.rb
195
- - test/unit/ext_action_mailer_test.rb
196
- - test/unit/maildown_test.rb
197
- - test/unit/markdown_engine_test.rb
File without changes