spreewald 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13490aa27d2ade6a30674d36cbe3374b0d4e6f4687958300b56047b2033a49b3
4
- data.tar.gz: 897b9e7881f0f50f32aa8c78afac85380a281e39bf25e007694bf9bb07654efc
3
+ metadata.gz: 6a51defb2267ab0f0f6e9123b474e0069758e59eaa3f18cadefdfdb81a5f5760
4
+ data.tar.gz: f47297c29b676ee194c1dbc2f335eab608afefa9730e124e8811d4542089031e
5
5
  SHA512:
6
- metadata.gz: f5653340cf2ae8b8f3aaabb29a47df7854e86fe1c88ef49310f583c7733e9ef8e49867e914ca4547a6b3ed3ee2f78dc4dc26a9c9dbda67ff426b38532efa8596
7
- data.tar.gz: b00d439380d560f792963261900b3840733c0a2f394da89de984ea3a3469b0ee549b30ea84491fcc2017eaebf3e15ce622439dac5ea55f1b94d7c4258fe8b179
6
+ metadata.gz: 3b93c18acce9d744364898f65e6f3597d06b37ed85d69bb81e3593521d0433bc56338b974c32133c0fce749190ee8af63c146b355e12601397b3641d4424380d
7
+ data.tar.gz: b675ad24c9c6e9836880d9111f1538d8f3b5c2d91e390dc5ee5165842cb19298d039fa428405dd47df20daa40b59234f641fcc3e4cab2cf0f6405449ecad981c
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## 3.0.3
7
+
8
+ - The `an email should have been sent with` step now interprets all lines as body when not specifying headers (see issue [#157](https://github.com/makandra/spreewald/issues/157))
9
+
6
10
  ## 3.0.2
7
11
 
8
12
  - Introduce wildcard for the beginning of a line. (see issue [#155](https://github.com/makandra/spreewald/issues/155))
@@ -15,6 +15,11 @@ class MailFinder
15
15
  end
16
16
  end
17
17
 
18
+ # Interpret all lines as body if there are no header-link lines
19
+ if conditions.blank?
20
+ body = [header, body].join("\n\n")
21
+ end
22
+
18
23
  filename_method = Rails::VERSION::MAJOR < 3 ? 'original_filename' : 'filename'
19
24
  matching_header = ActionMailer::Base.deliveries.select do |mail|
20
25
  [ conditions[:to].nil? || mail.to.include?(resolve_email conditions[:to]),
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '3.0.2'
2
+ VERSION = '3.0.3'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (3.0.2)
4
+ spreewald (3.0.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (3.0.2)
4
+ spreewald (3.0.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (3.0.2)
4
+ spreewald (3.0.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (3.0.2)
4
+ spreewald (3.0.3)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -46,5 +46,21 @@ class SpreewaldMailer < ApplicationMailer
46
46
  email
47
47
  end
48
48
 
49
+ def html_email_for_successful_test_without_header
50
+ email
51
+ end
52
+
53
+ def text_email_for_successful_test_without_header
54
+ email
55
+ end
56
+
57
+ def html_email_for_failed_test_without_header
58
+ email
59
+ end
60
+
61
+ def text_email_for_failed_test_without_header
62
+ email
63
+ end
64
+
49
65
  end
50
66
 
@@ -44,6 +44,26 @@ class EmailsController < ApplicationController
44
44
  render_nothing
45
45
  end
46
46
 
47
+ def send_html_email_for_successful_test_without_header
48
+ deliver :html_email_for_successful_test_without_header
49
+ render_nothing
50
+ end
51
+
52
+ def send_text_email_for_successful_test_without_header
53
+ deliver :text_email_for_successful_test_without_header
54
+ render_nothing
55
+ end
56
+
57
+ def send_html_email_for_failed_test_without_header
58
+ deliver :html_email_for_failed_test_without_header
59
+ render_nothing
60
+ end
61
+
62
+ def send_text_email_for_failed_test_without_header
63
+ deliver :text_email_for_failed_test_without_header
64
+ render_nothing
65
+ end
66
+
47
67
  private
48
68
 
49
69
  def deliver(method_name)
@@ -49,6 +49,22 @@ class Mailer < ActionMailer::Base
49
49
  email
50
50
  end
51
51
 
52
+ def html_email_for_successful_test_without_header
53
+ email
54
+ end
55
+
56
+ def text_email_for_successful_test_without_header
57
+ email
58
+ end
59
+
60
+ def html_email_for_failed_test_without_header
61
+ email
62
+ end
63
+
64
+ def text_email_for_failed_test_without_header
65
+ email
66
+ end
67
+
52
68
  else
53
69
 
54
70
  def email
@@ -82,6 +98,22 @@ class Mailer < ActionMailer::Base
82
98
  email
83
99
  end
84
100
 
101
+ def html_email_for_successful_test_without_header
102
+ email
103
+ end
104
+
105
+ def text_email_for_successful_test_without_header
106
+ email
107
+ end
108
+
109
+ def html_email_for_failed_test_without_header
110
+ email
111
+ end
112
+
113
+ def text_email_for_failed_test_without_header
114
+ email
115
+ end
116
+
85
117
  end
86
118
 
87
119
  end
@@ -0,0 +1,5 @@
1
+ !!!
2
+ %html(lang="en" xmlns="http://www.w3.org/1999/xhtml")
3
+ %body
4
+ %p
5
+ Bye
@@ -0,0 +1,7 @@
1
+ !!!
2
+ %html(lang="en" xmlns="http://www.w3.org/1999/xhtml")
3
+ %body
4
+ %p
5
+ Hello
6
+ %p
7
+ Bye
@@ -13,6 +13,10 @@ Rails.application.routes.draw do
13
13
  get '/emails/send_html_email_with_linebreaks', to: 'emails#send_html_email_with_linebreaks'
14
14
  get '/emails/send_html_email_with_specific_line', to: 'emails#send_html_email_with_specific_line'
15
15
  get '/emails/send_text_email_with_specific_line', to: 'emails#send_text_email_with_specific_line'
16
+ get '/emails/send_html_email_for_successful_test_without_header', to: 'emails#send_html_email_for_successful_test_without_header'
17
+ get '/emails/send_text_email_for_successful_test_without_header', to: 'emails#send_text_email_for_successful_test_without_header'
18
+ get '/emails/send_html_email_for_failed_test_without_header', to: 'emails#send_html_email_for_failed_test_without_header'
19
+ get '/emails/send_text_email_for_failed_test_without_header', to: 'emails#send_text_email_for_failed_test_without_header'
16
20
 
17
21
  get '/forms/checkbox_form', to: 'forms#checkbox_form'
18
22
  get '/forms/disabled_elements', to: 'forms#disabled_elements'
@@ -324,6 +324,127 @@ Feature: Test Spreewald's email steps
324
324
  '''
325
325
  """
326
326
 
327
+ # Tests without header
328
+ When I clear my emails
329
+ And I go to "/emails/send_text_email_for_successful_test_without_header"
330
+ Then the following multiline step should succeed:
331
+ """
332
+ Then an email should have been sent with:
333
+ '''
334
+ Hello
335
+
336
+ Bye
337
+ '''
338
+ """
339
+ And the following multiline step should succeed:
340
+ """
341
+ Then an email should have been sent with:
342
+ '''
343
+ To: to@example.com
344
+
345
+ Hello
346
+
347
+ Bye
348
+ '''
349
+ """
350
+ But the following multiline step should fail:
351
+ """
352
+ Then an email should have been sent with:
353
+ '''
354
+ To: wrong-guy@example.com
355
+
356
+ Hello
357
+
358
+ Bye
359
+ '''
360
+ """
361
+
362
+ When I clear my emails
363
+ And I go to "/emails/send_text_email_for_failed_test_without_header"
364
+ Then the following multiline step should fail:
365
+ """
366
+ Then an email should have been sent with:
367
+ '''
368
+ Hello
369
+
370
+ Bye
371
+ '''
372
+ """
373
+ But the following multiline step should succeed:
374
+ """
375
+ Then an email should have been sent with:
376
+ '''
377
+ Bye
378
+ '''
379
+ """
380
+ And the following multiline step should succeed:
381
+ """
382
+ Then an email should have been sent with:
383
+ '''
384
+ To: to@example.com
385
+
386
+ Bye
387
+ '''
388
+ """
389
+
390
+ When I clear my emails
391
+ And I go to "/emails/send_html_email_for_successful_test_without_header"
392
+ Then the following multiline step should succeed:
393
+ """
394
+ Then an email should have been sent with:
395
+ '''
396
+ Hello
397
+ Bye
398
+ '''
399
+ """
400
+ And the following multiline step should succeed:
401
+ """
402
+ Then an email should have been sent with:
403
+ '''
404
+ To: to@example.com
405
+
406
+ Hello
407
+ Bye
408
+ '''
409
+ """
410
+ But the following multiline step should fail:
411
+ """
412
+ Then an email should have been sent with:
413
+ '''
414
+ To: wrong-guy@example.com
415
+
416
+ Hello
417
+ Bye
418
+ '''
419
+ """
420
+
421
+ When I clear my emails
422
+ And I go to "/emails/send_html_email_for_failed_test_without_header"
423
+ Then the following multiline step should fail:
424
+ """
425
+ Then an email should have been sent with:
426
+ '''
427
+ Hello
428
+ Bye
429
+ '''
430
+ """
431
+ But the following multiline step should succeed:
432
+ """
433
+ Then an email should have been sent with:
434
+ '''
435
+ Bye
436
+ '''
437
+ """
438
+ And the following multiline step should succeed:
439
+ """
440
+ Then an email should have been sent with:
441
+ '''
442
+ To: to@example.com
443
+
444
+ Bye
445
+ '''
446
+ """
447
+
327
448
  Scenario: /^I follow the (first|second|third)? ?link in the e?mail$/ (HTML e-mail body)
328
449
  When I go to "/emails/send_html_email_with_links"
329
450
  And I follow the first link in the email
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreewald
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Kraze
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-18 00:00:00.000000000 Z
11
+ date: 2021-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -348,9 +348,13 @@ files:
348
348
  - tests/shared/app/views/mailer/email.text.erb
349
349
  - tests/shared/app/views/mailer/email_crlf.text.erb
350
350
  - tests/shared/app/views/mailer/email_with_umlauts.text.erb
351
+ - tests/shared/app/views/mailer/html_email_for_failed_test_without_header.haml
352
+ - tests/shared/app/views/mailer/html_email_for_successful_test_without_header.haml
351
353
  - tests/shared/app/views/mailer/html_email_with_linebreaks.html
352
354
  - tests/shared/app/views/mailer/html_email_with_links.haml
353
355
  - tests/shared/app/views/mailer/html_email_with_specific_line.haml
356
+ - tests/shared/app/views/mailer/text_email_for_failed_test_without_header.text.erb
357
+ - tests/shared/app/views/mailer/text_email_for_successful_test_without_header.text.erb
354
358
  - tests/shared/app/views/mailer/text_email_with_links.text.erb
355
359
  - tests/shared/app/views/mailer/text_email_with_specific_line.text.erb
356
360
  - tests/shared/app/views/spreewald_mailer
@@ -413,7 +417,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
417
  - !ruby/object:Gem::Version
414
418
  version: '0'
415
419
  requirements: []
416
- rubygems_version: 3.1.2
420
+ rubygems_version: 3.0.3
417
421
  signing_key:
418
422
  specification_version: 4
419
423
  summary: Collection of useful cucumber steps.
@@ -584,9 +588,13 @@ test_files:
584
588
  - tests/shared/app/views/mailer/email.text.erb
585
589
  - tests/shared/app/views/mailer/email_crlf.text.erb
586
590
  - tests/shared/app/views/mailer/email_with_umlauts.text.erb
591
+ - tests/shared/app/views/mailer/html_email_for_failed_test_without_header.haml
592
+ - tests/shared/app/views/mailer/html_email_for_successful_test_without_header.haml
587
593
  - tests/shared/app/views/mailer/html_email_with_linebreaks.html
588
594
  - tests/shared/app/views/mailer/html_email_with_links.haml
589
595
  - tests/shared/app/views/mailer/html_email_with_specific_line.haml
596
+ - tests/shared/app/views/mailer/text_email_for_failed_test_without_header.text.erb
597
+ - tests/shared/app/views/mailer/text_email_for_successful_test_without_header.text.erb
590
598
  - tests/shared/app/views/mailer/text_email_with_links.text.erb
591
599
  - tests/shared/app/views/mailer/text_email_with_specific_line.text.erb
592
600
  - tests/shared/app/views/spreewald_mailer