spreewald 4.6.2 → 4.6.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 +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.ruby266.lock +1 -1
- data/Gemfile.ruby320.lock +1 -1
- data/lib/spreewald_support/mail_finder.rb +10 -2
- data/lib/spreewald_support/version.rb +1 -1
- data/spec/steps/show_me_the_mails_spec.rb +22 -0
- data/tests/rails-7_capybara-3/Gemfile.lock +1 -1
- data/tests/shared/app/controllers/emails_controller.rb +1 -8
- data/tests/shared/app/models/mailer.rb +43 -96
- data/tests/shared/features/shared/email_steps.feature +18 -0
- 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: f21efaeee956e332f09bf91655335cfc24bcf5f5a46403c11ea6fa4d2f390b25
|
|
4
|
+
data.tar.gz: '09cae0432a1190dbfc515456705b6977ca4320c688e46ee5e1307a8ca07f9f69'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 295f1e8f0ea1b1b544d622005e020b8ba168eb27612077d55a58613162eb4ee65c0e32ba287ddef7f0fc58408817f48c3093e9b6c8ff94603076de3878ceccfc
|
|
7
|
+
data.tar.gz: d7ab22c6640d44c85c5b18f7c9e1028194eadd284d872aedf8ed56c64423a2e0409e8e545b2fbacf782d89ef219292797a5dc7a583494dcd5ce54c7bb7790399
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,9 @@ 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
|
+
## 4.6.3
|
|
7
|
+
- Fix email steps not showing the attachments
|
|
8
|
+
|
|
6
9
|
## 4.6.2
|
|
7
10
|
- Fix uninitialized constant `XPath::HTML` when using `When I fill in "..." with "..." inside any "..."` ([#210](https://github.com/makandra/spreewald/issues/210))
|
|
8
11
|
|
data/Gemfile.ruby266.lock
CHANGED
data/Gemfile.ruby320.lock
CHANGED
|
@@ -24,7 +24,6 @@ class MailFinder
|
|
|
24
24
|
body = [header, body].join("\n\n")
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
filename_method = Rails::VERSION::MAJOR < 3 ? 'original_filename' : 'filename'
|
|
28
27
|
matching_header = ActionMailer::Base.deliveries.select do |mail|
|
|
29
28
|
[ conditions[:to].nil? || mail.to.include?(resolve_email conditions[:to]),
|
|
30
29
|
conditions[:cc].nil? || mail.cc && mail.cc.include?(resolve_email conditions[:cc]),
|
|
@@ -32,7 +31,7 @@ class MailFinder
|
|
|
32
31
|
conditions[:from].nil? || mail.from.include?(resolve_email conditions[:from]),
|
|
33
32
|
conditions[:reply_to].nil? || mail.reply_to.include?(resolve_email conditions[:reply_to]),
|
|
34
33
|
conditions[:subject].nil? || mail.subject.include?(conditions[:subject]),
|
|
35
|
-
conditions[:attachments].nil? || conditions[:attachments].split(/\s*,\s*/).sort ==
|
|
34
|
+
conditions[:attachments].nil? || conditions[:attachments].split(/\s*,\s*/).sort == attachment_filenames(mail)
|
|
36
35
|
].all?
|
|
37
36
|
end
|
|
38
37
|
|
|
@@ -64,6 +63,9 @@ class MailFinder
|
|
|
64
63
|
header << "CC: #{mail.cc.join(', ')}\n" if mail.cc
|
|
65
64
|
header << "BCC: #{mail.bcc.join(', ')}\n" if mail.bcc
|
|
66
65
|
header << "Subject: #{mail.subject}\n"
|
|
66
|
+
header << "Attachments: #{attachment_filenames(mail).join(', ')}\n" if mail.attachments.any?
|
|
67
|
+
|
|
68
|
+
header
|
|
67
69
|
end
|
|
68
70
|
|
|
69
71
|
def email_text_body(mail, type = '')
|
|
@@ -94,6 +96,12 @@ class MailFinder
|
|
|
94
96
|
Regexp.new(expected)
|
|
95
97
|
end
|
|
96
98
|
|
|
99
|
+
private
|
|
100
|
+
|
|
101
|
+
def attachment_filenames(mail)
|
|
102
|
+
Array(mail.attachments).collect(&:filename).sort
|
|
103
|
+
end
|
|
104
|
+
|
|
97
105
|
end
|
|
98
106
|
end
|
|
99
107
|
|
|
@@ -93,4 +93,26 @@ describe Spreewald::Steps::ShowMeTheMails do
|
|
|
93
93
|
expect { step.run }.to output(expected_output).to_stdout
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
|
+
|
|
97
|
+
context "with attachments" do
|
|
98
|
+
it 'includes the filenames of the attachments' do
|
|
99
|
+
mail = Mail.new do
|
|
100
|
+
attachments['attached_file.pdf'] = File.open("tests/shared/public/fixture_files/attachment.pdf") {}
|
|
101
|
+
attachments['other_attached_file.pdf'] = File.open("tests/shared/public/fixture_files/attachment.pdf") {}
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
expected_output = <<~TXT
|
|
105
|
+
E-Mail #0
|
|
106
|
+
--------------------------------------------------------------------------------
|
|
107
|
+
From:
|
|
108
|
+
Subject:
|
|
109
|
+
Attachments: attached_file.pdf, other_attached_file.pdf
|
|
110
|
+
--------------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
TXT
|
|
113
|
+
step = Spreewald::Steps::ShowMeTheMails.new([mail], true)
|
|
114
|
+
expect { step.run }.to output(expected_output).to_stdout
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
96
118
|
end
|
|
@@ -67,14 +67,7 @@ class EmailsController < ApplicationController
|
|
|
67
67
|
private
|
|
68
68
|
|
|
69
69
|
def deliver(method_name)
|
|
70
|
-
|
|
71
|
-
when Rails.version.to_i >= 5
|
|
72
|
-
SpreewaldMailer.send(method_name).deliver
|
|
73
|
-
when Rails.version.to_i >= 3
|
|
74
|
-
Mailer.public_send(method_name).deliver
|
|
75
|
-
else
|
|
76
|
-
Mailer.public_send("deliver_#{method_name}")
|
|
77
|
-
end
|
|
70
|
+
SpreewaldMailer.send(method_name).deliver
|
|
78
71
|
end
|
|
79
72
|
|
|
80
73
|
end
|
|
@@ -7,113 +7,60 @@ class Mailer < ActionMailer::Base
|
|
|
7
7
|
FROM = "from@example.com"
|
|
8
8
|
SUBJECT = "SUBJECT"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def email_crlf
|
|
25
|
-
email
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def email_with_umlauts
|
|
29
|
-
email
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
def html_email_with_links
|
|
33
|
-
email
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def text_email_with_links
|
|
37
|
-
email
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def html_email_with_linebreaks
|
|
41
|
-
email
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def html_email_with_specific_line
|
|
45
|
-
email
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def text_email_with_specific_line
|
|
49
|
-
email
|
|
50
|
-
end
|
|
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
|
-
|
|
68
|
-
else
|
|
10
|
+
def email
|
|
11
|
+
attachments['attached_file.pdf'] = File.open("#{Rails.root}/public/fixture_files/attachment.pdf") {}
|
|
12
|
+
mail(
|
|
13
|
+
:from => FROM,
|
|
14
|
+
:reply_to => REPLY_TO,
|
|
15
|
+
:to => TO,
|
|
16
|
+
:cc => CC,
|
|
17
|
+
:bcc => BCC,
|
|
18
|
+
:subject => SUBJECT
|
|
19
|
+
)
|
|
20
|
+
end
|
|
69
21
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
reply_to REPLY_TO
|
|
74
|
-
from FROM
|
|
75
|
-
cc CC
|
|
76
|
-
bcc BCC
|
|
77
|
-
subject SUBJECT
|
|
78
|
-
body BODY
|
|
79
|
-
end
|
|
22
|
+
def email_crlf
|
|
23
|
+
email
|
|
24
|
+
end
|
|
80
25
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
26
|
+
def email_with_umlauts
|
|
27
|
+
email
|
|
28
|
+
end
|
|
84
29
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
30
|
+
def html_email_with_links
|
|
31
|
+
email
|
|
32
|
+
end
|
|
88
33
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
34
|
+
def text_email_with_links
|
|
35
|
+
email
|
|
36
|
+
end
|
|
92
37
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
38
|
+
def html_email_with_linebreaks
|
|
39
|
+
email
|
|
40
|
+
end
|
|
96
41
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
42
|
+
def html_email_with_specific_line
|
|
43
|
+
email
|
|
44
|
+
end
|
|
100
45
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
46
|
+
def text_email_with_specific_line
|
|
47
|
+
email
|
|
48
|
+
end
|
|
104
49
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
50
|
+
def html_email_for_successful_test_without_header
|
|
51
|
+
email
|
|
52
|
+
end
|
|
108
53
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
54
|
+
def text_email_for_successful_test_without_header
|
|
55
|
+
email
|
|
56
|
+
end
|
|
112
57
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
58
|
+
def html_email_for_failed_test_without_header
|
|
59
|
+
email
|
|
60
|
+
end
|
|
116
61
|
|
|
62
|
+
def text_email_for_failed_test_without_header
|
|
63
|
+
email
|
|
117
64
|
end
|
|
118
65
|
|
|
119
66
|
end
|
|
@@ -297,6 +297,24 @@ Feature: Test Spreewald's email steps
|
|
|
297
297
|
'''
|
|
298
298
|
"""
|
|
299
299
|
|
|
300
|
+
Then the following multiline step should succeed:
|
|
301
|
+
"""
|
|
302
|
+
Then an email should have been sent with:
|
|
303
|
+
'''
|
|
304
|
+
From: from@example.com
|
|
305
|
+
Attachments: attached_file.pdf
|
|
306
|
+
'''
|
|
307
|
+
"""
|
|
308
|
+
|
|
309
|
+
Then the following multiline step should fail:
|
|
310
|
+
"""
|
|
311
|
+
Then an email should have been sent with:
|
|
312
|
+
'''
|
|
313
|
+
From: from@example.com
|
|
314
|
+
Attachments: not_attached_file.pdf
|
|
315
|
+
'''
|
|
316
|
+
"""
|
|
317
|
+
|
|
300
318
|
When I clear my emails
|
|
301
319
|
And I go to "/emails/send_crlf_email"
|
|
302
320
|
|
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: 4.6.
|
|
4
|
+
version: 4.6.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: 2024-
|
|
11
|
+
date: 2024-11-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cucumber
|