spreewald 2.8.0 → 2.9.0

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: 59c446ad46ae093a7bb103d7e4959dbbc7e29327cbc30e5730aff221f8488e36
4
- data.tar.gz: e23e4bd833a6234e6ce2b4e6ab104f102708bab13ab54f10aad8b97df08cd39b
3
+ metadata.gz: 05a2f0dc08e4a044c5da09e999a488eeeab8d0ef21fd26fccf9306651e27d6ba
4
+ data.tar.gz: bc1753072141059f502b634a9a7347e63c602a072bc04f2a9aaf73a98ebd9eca
5
5
  SHA512:
6
- metadata.gz: 8d7b6e7ddd55b75433d7c800045c09f68b7175646de8a3f9ac11a5741ee83ce39c22d8bb5a8b5d9d77b4d22df01eda5de51093de4a76cabf73ae354308b12abc
7
- data.tar.gz: bc169b566a8878be0ad26b2b1522b960b57772d80d135ffbe4a34476c673282d75b7666d9ccf14a585c229739b3d543620f578c3b59a7e6f62cf036a5df2f90c
6
+ metadata.gz: 0b59488dcad4d0e94203fdc4b28463f69b6ccf93011f42c19dbc84582f0cca5e988a1b69c5f74520142198023dda9362e60c595d58a1bdc5abdde5b8a9e093ab
7
+ data.tar.gz: f324ae1ccd2ee7dbe97a71c4fbf614cd6888dd91846b42d2d60d900ae085413e6da55669d58ebe8275519354f10cf1a2826c5ef08323f30140d756572143dc76
@@ -3,6 +3,11 @@ 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
+ ## 2.9.0
7
+ - The step `an email should have been sent with:` does now support wildcards (`*` at the end of a line to ignore the rest of the line, `*` as single character in a line to ignore multiple lines). The step also has better error messages if an email could not be found.
8
+ - The step `show me the emails` got an option to display only the email headers. Additionally, a new step `show me the email( header)?s with:` has been created to only show a subset of all sent emails, with a syntax similar to `an email should have been sent with:`.
9
+ - The email steps `an email should have been sent (from ...) (to ...) (cc ...) ...`, `that email should( not)? have the following lines in the body` and `that email should have the following content in the body:` have been deprecated in favor of `an email should have been sent with:`.
10
+
6
11
  ## 2.8.0
7
12
  - Add radio buttons to the `the "..." (field|button|checkbox|radio button) should( not)? be disabled` step.
8
13
 
data/README.md CHANGED
@@ -216,7 +216,7 @@ the step definitions.
216
216
  * **When I clear my e?mails**
217
217
 
218
218
 
219
- * **Then (an|no) e?mail should have been sent with:**
219
+ * **Then (an?|no)( HTML| plain-text|) e?mail should have been sent with:**
220
220
 
221
221
  Example:
222
222
 
@@ -225,24 +225,23 @@ the step definitions.
225
225
  From: max.mustermann@example.com
226
226
  Reply-To: mmuster@gmail.com
227
227
  To: john.doe@example.com
228
+ CC: jane.doe@example.com
229
+ BCC: johnny.doe@example.com
228
230
  Subject: The subject may contain "quotes"
229
- Attachments: ...
231
+ Attachments: image.jpg, attachment.pdf
230
232
 
231
- Message body goes here.
232
- """
233
-
234
- You may skip lines in the header, of course. Note that the mail body is only checked for
235
- _inclusion_. That means you can only test a prefix of the body. The subject may also be
236
- a prefix.
237
-
238
-
239
- * **Then (an|no) e?mail should have been sent(( |and|with|from "..."|bcc "..."|cc "..."|to "..."|the subject "..."|the body "..."|the attachments "...")+)**
240
-
241
- Example:
233
+ This is the message body. You can use * as a wildcard to omit the rest
234
+ of a line *
235
+ Or you can omit multiple lines if the asterisk is the only
236
+ character in a single line, like this:
237
+ *
242
238
 
243
- Then an email should have been sent from "max.mustermann@example.com" to "john.doe@example.com" with bcc "john.wane@example.com" and with cc "foo@bar.com" and the subject "The subject" and the body "The body" and the attachments "attachment.pdf"
239
+ """
244
240
 
245
- You may skip parts, of course.
241
+ Because of backwards-compatibility, the body currently only has to be a prefix
242
+ of the real body. However, this is deprecated and will be removed in a future
243
+ version. Use wildcards instead.
244
+ You may skip lines in the header, of course.
246
245
 
247
246
 
248
247
  * **When I follow the (first|second|third)? link in the e?mail**
@@ -254,32 +253,20 @@ the step definitions.
254
253
  * **Then no e?mail should have been sent**
255
254
 
256
255
 
257
- * **Then I should see "..." in the e?mail**
256
+ * **Then I should see "..." in the( HTML| plain-text|) e?mail**
258
257
 
259
258
  Checks that the last sent email includes some text
260
259
 
261
260
 
262
- * **Then show me the e?mails**
263
-
264
- Print all sent emails to STDOUT.
261
+ * **Then show me the e?mail( header)?s**
265
262
 
266
-
267
- * **Then that e?mail should( not)? have the following lines in the body:**
268
-
269
- Example:
270
-
271
- And that mail should have the following lines in the body:
272
- """
273
- All of these lines
274
- need to be present
275
- """
276
-
277
- You may skip lines, of course. Note that you may also omit text at the end of each line.
263
+ Print all sent emails to STDOUT (optionally only the headers).
278
264
 
279
265
 
280
- * **Then that e?mail should have the following (|content in the )body:**
266
+ * **Then show me the e?mail( header)?s with:**
281
267
 
282
- Checks that the text should be included anywhere in the retrieved email body
268
+ Print a subset of all sent emails to STDOUT
269
+ This uses the same syntax as `Then an email should have been sent with:`
283
270
 
284
271
 
285
272
  ### file_attachment_steps.rb
@@ -17,49 +17,74 @@ end.overridable
17
17
  # From: max.mustermann@example.com
18
18
  # Reply-To: mmuster@gmail.com
19
19
  # To: john.doe@example.com
20
+ # CC: jane.doe@example.com
21
+ # BCC: johnny.doe@example.com
20
22
  # Subject: The subject may contain "quotes"
21
- # Attachments: ...
23
+ # Attachments: image.jpg, attachment.pdf
24
+ #
25
+ # This is the message body. You can use * as a wildcard to omit the rest
26
+ # of a line *
27
+ # Or you can omit multiple lines if the asterisk is the only
28
+ # character in a single line, like this:
29
+ # *
22
30
  #
23
- # Message body goes here.
24
31
  # """
25
32
  #
26
- # You may skip lines in the header, of course. Note that the mail body is only checked for
27
- # _inclusion_. That means you can only test a prefix of the body. The subject may also be
28
- # a prefix.
29
- Then /^(an|no) e?mail should have been sent with:$/ do |mode, raw_data|
33
+ # Because of backwards-compatibility, the body currently only has to be a prefix
34
+ # of the real body. However, this is deprecated and will be removed in a future
35
+ # version. Use wildcards instead.
36
+ # You may skip lines in the header, of course.
37
+ Then /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/ do |mode, type, raw_data|
30
38
  patiently do
31
- raw_data.strip!
32
- header, body = raw_data.split(/\n\n/, 2) # 2: maximum number of fields
33
- conditions = {}
34
- header.split("\n").each do |row|
35
- if row.match(/^[a-z\-]+: /i)
36
- key, value = row.split(": ", 2)
37
- conditions[key.underscore.to_sym] = value
39
+ results = MailFinder.find(raw_data, type.strip)
40
+
41
+ if mode == 'no'
42
+ expect(results).to be_empty
43
+ else
44
+ if results.one?
45
+ @mail = results.mails[0]
46
+ elsif results.many?
47
+ warn <<-WARNING
48
+ #{results.size} emails were found with the following conditions.
49
+ You may want to make the description more precise or clear the emails in between.
50
+ #{raw_data}
51
+ WARNING
52
+ else
53
+ message = <<-ERROR
54
+ No matching mail was found. There were #{ActionMailer::Base.deliveries.size} mails in total.
55
+ #{results.matching_header.size} of those had matching headers.
56
+ ERROR
57
+ if results.matching_header.empty?
58
+ message << "Expected\n" + '-' * 80 + "\n"
59
+ message << raw_data.split(/\n\n/, 2)[0] # Show the expected header
60
+ message << "\n" + '-' * 80 + "\n\n"
61
+ message << MailFinder.show_mails(ActionMailer::Base.deliveries, true)
62
+ else
63
+ message << "\nTried to match #{results.body_regex.inspect} in the following mails:\n"
64
+ message << results.matching_header.map { |mail| MailFinder.email_text_body(mail, type.strip).strip.inspect }.join("\n")
65
+ message << "\n"
66
+ end
67
+ raise RSpec::Expectations::ExpectationNotMetError.new(message)
38
68
  end
39
69
  end
40
- conditions[:body] = body if body
41
- @mail = MailFinder.find(conditions)
42
- expectation = mode == 'no' ? 'not_to' : 'to'
43
- expect(@mail).send(expectation, be_present)
44
70
  end
45
71
  end.overridable
46
72
 
47
- # Example:
48
- #
49
- # Then an email should have been sent from "max.mustermann@example.com" to "john.doe@example.com" with bcc "john.wane@example.com" and with cc "foo@bar.com" and the subject "The subject" and the body "The body" and the attachments "attachment.pdf"
50
- #
51
- # You may skip parts, of course.
73
+ # nodoc (deprecated)
52
74
  Then /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/ do |mode, query|
75
+ warn "The step `an email should have been sent (from ...) (to ...) (cc ...) ...` has been deprecated in favor of `(an?|no)( HTML| plain-text|) e?mail should have been sent with:`"
53
76
  patiently do
54
- conditions = {}
55
- conditions[:to] = $1 if query =~ /to "([^"]+)"/
56
- conditions[:Cc] = $1 if query =~ /cc "([^"]+)"/
57
- conditions[:bcc] = $1 if query =~ /bcc "([^"]+)"/
58
- conditions[:from] = $1 if query =~ /from "([^"]+)"/
59
- conditions[:subject] = $1 if query =~ /the subject "([^"]+)"/
60
- conditions[:body] = $1 if query =~ /the body "([^"]+)"/
61
- conditions[:attachments] = $1 if query =~ /the attachments "([^"]+)"/
62
- @mail = MailFinder.find(conditions)
77
+ filename_method = Rails::VERSION::MAJOR < 3 ? 'original_filename' : 'filename'
78
+ @mail = ActionMailer::Base.deliveries.find do |mail|
79
+ [ query =~ /to "([^"]+)"/ && !mail.to.include?(MailFinder.resolve_email $1),
80
+ query =~ /cc "([^"]+)"/ && !mail.cc.include?(MailFinder.resolve_email $1),
81
+ query =~ /bcc "([^"]+)"/ && !mail.bcc.include?(MailFinder.resolve_email $1),
82
+ query =~ /from "([^"]+)"/ && !mail.from.include?(MailFinder.resolve_email $1),
83
+ query =~ /reply_to "([^"]+)"/ && !mail.reply_to.include?(MailFinder.resolve_email $1),
84
+ query =~ /subject "([^"]+)"/ && !mail.subject.include?($1),
85
+ query =~ /the attachments "([^"]+)"/ && $1.split(/\s*,\s*/).sort != Array(mail.attachments).collect(&:"#{filename_method}").sort
86
+ ].none?
87
+ end
63
88
  expectation = mode == 'no' ? 'not_to' : 'to'
64
89
  expect(@mail).send(expectation, be_present)
65
90
  end
@@ -88,34 +113,38 @@ Then /^no e?mail should have been sent$/ do
88
113
  end.overridable
89
114
 
90
115
  # Checks that the last sent email includes some text
91
- Then /^I should see "([^\"]*)" in the e?mail$/ do |text|
92
- expect(MailFinder.email_text_body(ActionMailer::Base.deliveries.last)).to include(text)
116
+ Then /^I should see "([^\"]*)" in the( HTML| plain-text|) e?mail$/ do |text, type|
117
+ expect(MailFinder.email_text_body(ActionMailer::Base.deliveries.last, type.strip)).to include(text)
118
+ end.overridable
119
+
120
+ # Print all sent emails to STDOUT (optionally only the headers).
121
+ Then /^show me the e?mail( header)?s$/ do |only_header|
122
+ if ActionMailer::Base.deliveries.empty?
123
+ puts MailFinder.show_mails(ActionMailer::Base.deliveries, only_header)
124
+ else
125
+ puts "No emails found" if ActionMailer::Base.deliveries.empty?
126
+ end
127
+
93
128
  end.overridable
94
129
 
95
- # Print all sent emails to STDOUT.
96
- Then /^show me the e?mails$/ do
97
- ActionMailer::Base.deliveries.each_with_index do |mail, i|
98
- puts "E-Mail ##{i}"
99
- print "-" * 80
100
- puts [ "From: #{mail.from}",
101
- "To: #{mail.to}",
102
- "Subject: #{mail.subject}",
103
- "\n" + MailFinder.email_text_body(mail)
104
- ].join("\n")
105
- print "-" * 80
130
+ # Print a subset of all sent emails to STDOUT
131
+ # This uses the same syntax as `Then an email should have been sent with:`
132
+ Then /^show me the e?mail( header)?s with:$/ do |only_header, raw_data|
133
+ results = MailFinder.find(raw_data)
134
+ if results.empty?
135
+ if results.matching_header.empty?
136
+ puts "There are no emails matching the given header."
137
+ else
138
+ puts "There are no emails matching the given header and body, but #{results.matching_header.size} matching only the header."
139
+ end
106
140
  end
141
+
142
+ print MailFinder.show_mails(results.mails, only_header)
107
143
  end.overridable
108
144
 
109
- # Example:
110
- #
111
- # And that mail should have the following lines in the body:
112
- # """
113
- # All of these lines
114
- # need to be present
115
- # """
116
- #
117
- # You may skip lines, of course. Note that you may also omit text at the end of each line.
145
+ # nodoc (deprecated)
118
146
  Then /^that e?mail should( not)? have the following lines in the body:$/ do |negate, body|
147
+ warn "The step /^that e?mail should( not)? have the following lines in the body:$/ has been deprecated in favor of the updated step /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/."
119
148
  expectation = negate ? 'not_to' : 'to'
120
149
  mail = @mail || ActionMailer::Base.deliveries.last
121
150
  email_text_body = MailFinder.email_text_body(mail)
@@ -125,8 +154,9 @@ Then /^that e?mail should( not)? have the following lines in the body:$/ do |neg
125
154
  end
126
155
  end.overridable
127
156
 
128
- # Checks that the text should be included anywhere in the retrieved email body
157
+ # nodoc (deprecated)
129
158
  Then /^that e?mail should have the following (?:|content in the )body:$/ do |body|
159
+ warn "The step /^that e?mail should have the following( content in the)? body:$/ has been deprecated in favor of the updated step /^(an?|no)( HTML| plain-text|) e?mail should have been sent with:$/."
130
160
  mail = @mail || ActionMailer::Base.deliveries.last
131
161
  expect(MailFinder.email_text_body(mail)).to include(body.strip)
132
162
  end.overridable
@@ -5,22 +5,38 @@ class MailFinder
5
5
 
6
6
  attr_accessor :user_identity
7
7
 
8
- def find(conditions)
8
+ def find(raw_data, type = '')
9
+ header, body = raw_data.split(/\n\n/, 2) # 2: maximum number of fields
10
+ conditions = {}
11
+ header.split("\n").each do |row|
12
+ if row.match(/^[A-Za-z\-]+: /i)
13
+ key, value = row.split(": ", 2)
14
+ conditions[key.strip.underscore.to_sym] = value.strip
15
+ end
16
+ end
17
+
9
18
  filename_method = Rails::VERSION::MAJOR < 3 ? 'original_filename' : 'filename'
10
- ActionMailer::Base.deliveries.detect do |mail|
11
- mail_body = email_text_body(mail)
19
+ matching_header = ActionMailer::Base.deliveries.select do |mail|
12
20
  [ conditions[:to].nil? || mail.to.include?(resolve_email conditions[:to]),
13
21
  conditions[:cc].nil? || mail.cc && mail.cc.include?(resolve_email conditions[:cc]),
14
22
  conditions[:bcc].nil? || mail.bcc && mail.bcc.include?(resolve_email conditions[:bcc]),
15
23
  conditions[:from].nil? || mail.from.include?(resolve_email conditions[:from]),
16
24
  conditions[:reply_to].nil? || mail.reply_to.include?(resolve_email conditions[:reply_to]),
17
25
  conditions[:subject].nil? || mail.subject.include?(conditions[:subject]),
18
- conditions[:body].nil? || mail_body.include?(conditions[:body]),
19
26
  conditions[:attachments].nil? || conditions[:attachments].split(/\s*,\s*/).sort == Array(mail.attachments).collect(&:"#{filename_method}").sort
20
27
  ].all?
21
- end.tap do |mail|
22
- log(mail)
23
28
  end
29
+
30
+ matching_mails = if body
31
+ body_regex = expected_body_regex(body)
32
+ matching_header.select do |mail|
33
+ body_regex =~ email_text_body(mail, type).strip
34
+ end
35
+ else
36
+ matching_header
37
+ end
38
+
39
+ Results.new(matching_mails, matching_header, body_regex)
24
40
  end
25
41
 
26
42
  def resolve_email(identity)
@@ -31,46 +47,60 @@ class MailFinder
31
47
  end
32
48
  end
33
49
 
34
- def log(mail)
35
- if mail.present?
36
- File.open("log/test_mails.log", "a") do |file|
37
- file << "From: #{mail.from}\n"
38
- file << "To: #{mail.to.join(', ')}\n" if mail.to
39
- file << "Subject: #{mail.subject}\n\n"
40
- file << email_text_body(mail)
41
- file << "\n-------------------------\n\n"
42
- end
43
- end
50
+ def header_representation(mail)
51
+ header = ""
52
+ header << "From: #{mail.from}\n"
53
+ header << "Reply-To: #{mail.reply_to.join(', ')}\n" if mail.reply_to
54
+ header << "To: #{mail.to.join(', ')}\n" if mail.to
55
+ header << "CC: #{mail.cc.join(', ')}\n" if mail.cc
56
+ header << "BCC: #{mail.bcc.join(', ')}\n" if mail.bcc
57
+ header << "Subject: #{mail.subject}\n"
44
58
  end
45
59
 
46
- def email_text_body(mail)
47
- body = if mail.parts.any?
48
- mail_bodies = mail.parts.map { |part|
49
- if part.header.to_s.include?('Quoted-printable')
50
- if Rails.version.starts_with?('2.3')
51
- part.body.to_s
52
- else
53
- part.decoded
54
- end
55
- elsif part.content_type.include?('multipart/alternative')
56
- part.parts.map(&:decoded)
57
- else
58
- part.decoded
59
- end
60
- }
61
- utf8_parts = mail_bodies.flatten.select{ |part|
62
- encoding = part.try(:encoding)
63
- encoding.nil? or # Ruby < 1.9.1
64
- encoding.name == 'UTF-8' # Ruby > 1.9.1
65
- }
66
- utf8_parts.join('\n')
67
- elsif mail.body.respond_to? :raw_source
68
- mail.body.raw_source
60
+ def email_text_body(mail, type = '')
61
+ if mail.html_part && type != 'plain-text'
62
+ dom = Nokogiri::HTML(mail.html_part.body.to_s)
63
+ dom.at_css('body').text.gsub(/\n\n/, "\n")
64
+ elsif mail.text_part && type != 'HTML'
65
+ mail.text_part.body.to_s
69
66
  else
70
- mail.body
67
+ mail.body.to_s
71
68
  end
72
- body.gsub("\r\n", "\n") # The mail gem (>= 2.7.1) switched from \n to \r\n line breaks (LF to CRLF) in plain text mails.
73
69
  end
74
70
 
71
+ def show_mails(mails, only_header = false)
72
+ message = ""
73
+ mails.each_with_index do |mail, i|
74
+ message << "E-Mail ##{i}\n"
75
+ message << "-" * 80 + "\n"
76
+ message << header_representation(mail)
77
+ message << "\n" + email_text_body(mail).strip + "\n" unless only_header
78
+ message << "-" * 80 + "\n\n"
79
+ end
80
+ message
81
+ end
82
+
83
+ def expected_body_regex(expected_body)
84
+ # To stay backwards-compatible, this will only check whether an email
85
+ # starts with the expected body.
86
+ expected = '\A\n' + Regexp.quote(expected_body.strip) + '\n\Z'
87
+ expected.gsub! '\n\*\n', '\n[\s\S]*\n'
88
+ expected.gsub! '\*\n', '.*\n'
89
+
90
+ expected.gsub! '\A\n', '\A'
91
+ expected.gsub! '\n\Z', '' # Change '' to '\Z' to force that the whole body matches
92
+
93
+ Regexp.new(expected)
94
+ end
95
+
96
+ end
97
+ end
98
+
99
+ class MailFinder::Results < Struct.new(:mails, :matching_header, :body_regex)
100
+ extend Forwardable
101
+ delegate [:size, :one?, :empty?] => :mails
102
+
103
+ def many?
104
+ size > 1
75
105
  end
76
106
  end
@@ -1,3 +1,3 @@
1
1
  module Spreewald
2
- VERSION = '2.8.0'
2
+ VERSION = '2.9.0'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- spreewald (2.8.0)
4
+ spreewald (2.9.0)
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 (2.8.0)
4
+ spreewald (2.9.0)
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 (2.8.0)
4
+ spreewald (2.9.0)
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 (2.8.0)
4
+ spreewald (2.9.0)
5
5
  cucumber
6
6
  cucumber_priority (>= 0.3.0)
7
7
  rspec (>= 2.13.0)
@@ -1,10 +1,10 @@
1
1
  Feature: Test Spreewald's email steps
2
-
2
+
3
3
  Scenario: /^no e?mail should have been sent$/
4
4
  When I go to "/emails/do_nothing"
5
5
  Then the following step should succeed:
6
6
  | no email should have been sent |
7
-
7
+
8
8
  When I go to "/emails/send_email"
9
9
  Then the following step should fail:
10
10
  | no email should have been sent |
@@ -50,6 +50,53 @@ Feature: Test Spreewald's email steps
50
50
  '''
51
51
  """
52
52
 
53
+ # Test with end-of-line wildcards
54
+ Then the following multiline step should succeed:
55
+ """
56
+ Then an email should have been sent with:
57
+ '''
58
+ From: from@example.com
59
+ Reply-To: reply-to@example.com
60
+ To: to@example.com
61
+ Subject: SUBJECT
62
+
63
+ Bo*
64
+ wi*
65
+ li*
66
+ br*
67
+ '''
68
+ """
69
+
70
+ # Test with multiple-line wildcards
71
+ Then the following multiline step should succeed:
72
+ """
73
+ Then an email should have been sent with:
74
+ '''
75
+ From: from@example.com
76
+ Reply-To: reply-to@example.com
77
+ To: to@example.com
78
+ Subject: SUBJECT
79
+
80
+ Body
81
+ *
82
+ breaks
83
+ '''
84
+ """
85
+
86
+ # Test with the whole body being a multiple-line wildcard
87
+ Then the following multiline step should succeed:
88
+ """
89
+ Then an email should have been sent with:
90
+ '''
91
+ From: from@example.com
92
+ Reply-To: reply-to@example.com
93
+ To: to@example.com
94
+ Subject: SUBJECT
95
+
96
+ *
97
+ '''
98
+ """
99
+
53
100
  # Test with incorrect From header
54
101
  Then the following multiline step should fail:
55
102
  """
@@ -148,12 +195,29 @@ Feature: Test Spreewald's email steps
148
195
  with
149
196
  line
150
197
  breaks
151
-
198
+
152
199
  MORE-BODY
153
200
  '''
154
201
  """
155
202
 
156
- Scenario: /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/
203
+ # Test body with wildcard not at the end of a line
204
+ Then the following multiline step should fail:
205
+ """
206
+ Then an email should have been sent with:
207
+ '''
208
+ From: from@example.com
209
+ Reply-To: reply-to@example.com
210
+ To: to@example.com
211
+ Subject: SUBJECT
212
+
213
+ Body
214
+ *th
215
+ line
216
+ break
217
+ '''
218
+ """
219
+
220
+ Scenario: Scenario: /^(an|no) e?mail should have been sent((?: |and|with|from "[^"]+"|bcc "[^"]+"|cc "[^"]+"|to "[^"]+"|the subject "[^"]+"|the body "[^"]+"|the attachments "[^"]+")+)$/
157
221
  When I go to "/emails/send_email"
158
222
 
159
223
  # Test with correct conditions
@@ -181,7 +245,7 @@ Feature: Test Spreewald's email steps
181
245
  '''
182
246
  """
183
247
 
184
- # Test with wrong body lines
248
+ # Test with wrong body lines
185
249
  Then the following multiline step should fail:
186
250
  """
187
251
  Then that email should have the following lines in the body:
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: 2.8.0
4
+ version: 2.9.0
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-09-09 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber