spreewald 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +20 -33
- data/lib/spreewald/email_steps.rb +84 -54
- data/lib/spreewald_support/mail_finder.rb +71 -41
- data/lib/spreewald_support/version.rb +1 -1
- data/tests/rails-3_capybara-1/Gemfile.lock +1 -1
- data/tests/rails-3_capybara-2/Gemfile.lock +1 -1
- data/tests/rails-4_capybara-3/Gemfile.lock +1 -1
- data/tests/rails-6_capybara-3/Gemfile.lock +1 -1
- data/tests/shared/features/shared/email_steps.feature +69 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05a2f0dc08e4a044c5da09e999a488eeeab8d0ef21fd26fccf9306651e27d6ba
|
4
|
+
data.tar.gz: bc1753072141059f502b634a9a7347e63c602a072bc04f2a9aaf73a98ebd9eca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b59488dcad4d0e94203fdc4b28463f69b6ccf93011f42c19dbc84582f0cca5e988a1b69c5f74520142198023dda9362e60c595d58a1bdc5abdde5b8a9e093ab
|
7
|
+
data.tar.gz: f324ae1ccd2ee7dbe97a71c4fbf614cd6888dd91846b42d2d60d900ae085413e6da55669d58ebe8275519354f10cf1a2826c5ef08323f30140d756572143dc76
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
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
|
-
|
239
|
+
"""
|
244
240
|
|
245
|
-
|
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?
|
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
|
266
|
+
* **Then show me the e?mail( header)?s with:**
|
281
267
|
|
282
|
-
|
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
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
#
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
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
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
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
|
-
#
|
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
|
-
#
|
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(
|
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.
|
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
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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,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
|
-
|
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
|
-
|
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.
|
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-
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|