email_spec 2.2.0 → 2.3.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 +5 -5
- data/Changelog.md +18 -0
- data/README.md +14 -2
- data/features/step_definitions/app_steps.rb +4 -4
- data/lib/email_spec/deliveries.rb +12 -37
- data/lib/email_spec/extractors.rb +45 -0
- data/lib/email_spec/mail_ext.rb +2 -2
- data/lib/email_spec/matchers.rb +25 -5
- data/lib/email_spec/version.rb +3 -1
- data/spec/email_spec/mail_ext_spec.rb +8 -0
- data/spec/email_spec/matchers_spec.rb +113 -1
- metadata +15 -28
- data/examples/rails4_root/Gemfile.lock +0 -199
- data/examples/rails4_root/db/test.sqlite3 +0 -0
- data/examples/rails4_root/log/development.log +0 -0
- data/examples/rails4_root/log/test.log +0 -1498
- data/examples/sinatra_root/Gemfile.lock +0 -107
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4e0a37bd9d3d9eaa30f18b427930baa52d8b895b50d4d7b831650d621a9c955e
|
|
4
|
+
data.tar.gz: 4193090888bee1123f782507dc6c8496b9bca6ff0aea94612624a48f9d45d65b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 97b61a1089f4c29bdcfffca000405a5d66bc2430dca4c9e293090cea5a12ebae9bacc108c3663b9a3961a5f955d59a0870a28c53a19d0782ed9d66ff6cfea15a
|
|
7
|
+
data.tar.gz: b38641514a7ceace6ea75f178865dffd9b910cebbc2eb28fea8c1ea3a7f64786e248900f34dd881f722c251ceb12e5f52f071257cf10b15eb316ad1a2e9e9427
|
data/Changelog.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 2.3.0 2024-07-21
|
|
2
|
+
|
|
3
|
+
* [Support the specified name and address for bcc_to and cc_to matchers](https://github.com/email-spec/email-spec/pull/212)
|
|
4
|
+
* [Allow launchy 3.x versions](https://github.com/email-spec/email-spec/pull/226)
|
|
5
|
+
* [Replace deprecated/removed File.exists? alias](https://github.com/email-spec/email-spec/pull/223)
|
|
6
|
+
* [Extend have_body_text matcher to be able to specify which part in multipart to check](https://github.com/email-spec/email-spec/pull/196)
|
|
7
|
+
|
|
8
|
+
## 2.2.2 2023-06-26
|
|
9
|
+
|
|
10
|
+
* [Defer accommodating different delivery methods to runtime](https://github.com/email-spec/email-spec/pull/224)
|
|
11
|
+
|
|
12
|
+
## 2.2.1 2022-09-12
|
|
13
|
+
|
|
14
|
+
* [Support to decode part in EmailSpec::MailExt#default_part_body](https://github.com/email-spec/email-spec/pull/211)
|
|
15
|
+
* [Drop rubyforge_project from gemspec](https://github.com/email-spec/email-spec/pull/215)
|
|
16
|
+
* [Avoid eagerly loading ActionMailer::Base](https://github.com/email-spec/email-spec/pull/219)
|
|
17
|
+
* [README: use SVG badges](https://github.com/email-spec/email-spec/pull/217)
|
|
18
|
+
|
|
1
19
|
## 2.2.0 2018-04-03
|
|
2
20
|
|
|
3
21
|
* Support for `spinach` (@pedantic-git)
|
data/README.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
[](http://travis-ci.org/email-spec/email-spec)
|
|
1
|
+
[](http://travis-ci.org/email-spec/email-spec)
|
|
3
2
|
|
|
4
3
|
## Email Spec
|
|
5
4
|
|
|
@@ -303,6 +302,15 @@ expect(email).to have_body_text(/Hi Jojo Binks,/)
|
|
|
303
302
|
```
|
|
304
303
|
|
|
305
304
|
|
|
305
|
+
You can specify which part in multipart to check with `in_html_part` or
|
|
306
|
+
`in_text_part`.
|
|
307
|
+
|
|
308
|
+
```ruby
|
|
309
|
+
email = UserMailer.("jojo@yahoo.com", "Jojo Binks")
|
|
310
|
+
expect(email).to have_body_text(/This is html/).in_html_part
|
|
311
|
+
expect(email).to have_body_text(/This is text/).in_text_part
|
|
312
|
+
```
|
|
313
|
+
|
|
306
314
|
##### have_header(key, value)
|
|
307
315
|
|
|
308
316
|
This checks that the expected key/value pair is in the headers of the email.
|
|
@@ -339,6 +347,10 @@ email = UserMailer.create_signup "jojo@yahoo.com", "Jojo Binks"
|
|
|
339
347
|
assert_must deliver_to("jojo@yahoo.com"), email
|
|
340
348
|
```
|
|
341
349
|
|
|
350
|
+
## Issue triage [](https://www.codetriage.com/email-spec/email-spec)
|
|
351
|
+
|
|
352
|
+
You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to email-spec on CodeTriage](https://www.codetriage.com/email-spec/email-spec).
|
|
353
|
+
|
|
342
354
|
## Original Authors
|
|
343
355
|
|
|
344
356
|
Ben Mabey, Aaron Gibralter, Mischa Fierer
|
|
@@ -6,13 +6,13 @@ Given /^the (\w+) app is setup with the latest email steps$/ do |app_name|
|
|
|
6
6
|
'email_steps.rb')
|
|
7
7
|
latest_specs_path = File.join(root_dir, 'lib', 'generators', 'email_spec',
|
|
8
8
|
'steps', 'templates','email_steps.rb')
|
|
9
|
-
FileUtils.rm(email_specs_path) if File.
|
|
9
|
+
FileUtils.rm(email_specs_path) if File.exist?(email_specs_path)
|
|
10
10
|
FileUtils.cp_r(latest_specs_path, email_specs_path)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
Then /^the (\w+) app should have the email steps in place$/ do |app_name|
|
|
14
14
|
email_specs_path = "#{root_dir}/examples/#{app_name}_root/features/step_definitions/email_steps.rb"
|
|
15
|
-
expect(File.
|
|
15
|
+
expect(File.exist?(email_specs_path)).to be true
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
Then /^I should see the following summary report:$/ do |expected_report|
|
|
@@ -22,7 +22,7 @@ end
|
|
|
22
22
|
Given /^the (\w+) app is setup with the latest generators$/ do |app_name|
|
|
23
23
|
app_dir= File.join(root_dir,'examples',"#{app_name}_root")
|
|
24
24
|
email_specs_path = File.join(app_dir,'features','step_definitions','email_steps.rb')
|
|
25
|
-
FileUtils.rm(email_specs_path) if File.
|
|
25
|
+
FileUtils.rm(email_specs_path) if File.exist?(email_specs_path)
|
|
26
26
|
|
|
27
27
|
if app_name == 'rails4'
|
|
28
28
|
#Testing using the gem
|
|
@@ -46,7 +46,7 @@ When /^I run "([^\"]*)" in the (\w+) app$/ do |cmd, app_name|
|
|
|
46
46
|
app_specific_gemfile = File.join(app_path,'Gemfile')
|
|
47
47
|
Dir.chdir(app_path) do
|
|
48
48
|
#hack to fight competing bundles (email specs vs rails4_root's
|
|
49
|
-
if File.
|
|
49
|
+
if File.exist? app_specific_gemfile
|
|
50
50
|
orig_gemfile = ENV['BUNDLE_GEMFILE']
|
|
51
51
|
ENV['BUNDLE_GEMFILE'] = app_specific_gemfile
|
|
52
52
|
@output = `#{cmd}`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module EmailSpec
|
|
2
|
-
module
|
|
2
|
+
module Deliveries
|
|
3
3
|
def all_emails
|
|
4
4
|
deliveries
|
|
5
5
|
end
|
|
@@ -9,7 +9,9 @@ module EmailSpec
|
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def reset_mailer
|
|
12
|
-
if defined?(ActionMailer) && ActionMailer::Base.delivery_method == :
|
|
12
|
+
if defined?(ActionMailer) && ActionMailer::Base.delivery_method == :activerecord
|
|
13
|
+
Email.delete_all
|
|
14
|
+
elsif defined?(ActionMailer) && ActionMailer::Base.delivery_method == :cache
|
|
13
15
|
mailer.clear_cache
|
|
14
16
|
else
|
|
15
17
|
deliveries.clear
|
|
@@ -23,36 +25,22 @@ module EmailSpec
|
|
|
23
25
|
protected
|
|
24
26
|
|
|
25
27
|
def deliveries
|
|
26
|
-
if
|
|
28
|
+
if defined?(Pony)
|
|
29
|
+
Pony.deliveries
|
|
30
|
+
elsif ActionMailer::Base.delivery_method == :activerecord
|
|
31
|
+
Email.all.map { |email| parse_ar_to_mail(email) }
|
|
32
|
+
elsif ActionMailer::Base.delivery_method == :cache
|
|
27
33
|
mailer.cached_deliveries
|
|
28
34
|
else
|
|
29
35
|
mailer.deliveries
|
|
30
36
|
end
|
|
31
37
|
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
module ARMailerDeliveries
|
|
35
|
-
def all_emails
|
|
36
|
-
Email.all.map{ |email| parse_to_mail(email) }
|
|
37
|
-
end
|
|
38
38
|
|
|
39
|
-
def
|
|
40
|
-
|
|
41
|
-
parse_to_mail(email)
|
|
42
|
-
else
|
|
43
|
-
raise("No email has been sent!")
|
|
44
|
-
end
|
|
39
|
+
def mailer
|
|
40
|
+
ActionMailer::Base
|
|
45
41
|
end
|
|
46
42
|
|
|
47
|
-
def
|
|
48
|
-
Email.delete_all
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def mailbox_for(address)
|
|
52
|
-
Email.all.select { |email| email.destinations.include?(address) }.map{ |email| parse_to_mail(email) }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def parse_to_mail(email)
|
|
43
|
+
def parse_ar_to_mail(email)
|
|
56
44
|
Mail.read(email.mail)
|
|
57
45
|
end
|
|
58
46
|
end
|
|
@@ -68,17 +56,4 @@ module EmailSpec
|
|
|
68
56
|
end
|
|
69
57
|
end
|
|
70
58
|
end
|
|
71
|
-
|
|
72
|
-
module Deliveries
|
|
73
|
-
if defined?(Pony)
|
|
74
|
-
def deliveries; Pony::deliveries ; end
|
|
75
|
-
include EmailSpec::MailerDeliveries
|
|
76
|
-
elsif ActionMailer::Base.delivery_method == :activerecord
|
|
77
|
-
include EmailSpec::ARMailerDeliveries
|
|
78
|
-
else
|
|
79
|
-
def mailer; ActionMailer::Base; end
|
|
80
|
-
include EmailSpec::MailerDeliveries
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
59
|
end
|
|
84
|
-
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
module EmailSpec
|
|
2
|
+
module Extractors
|
|
3
|
+
class Base
|
|
4
|
+
attr_accessor :mail
|
|
5
|
+
|
|
6
|
+
def initialize(mail)
|
|
7
|
+
@mail = mail
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def call
|
|
11
|
+
part_body ? HTMLEntities.new.decode(part_body) : ''
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def part_body
|
|
17
|
+
raise NotImplementedError
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class DefaultPartBody < Base
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def part_body
|
|
25
|
+
(mail.html_part || mail.text_part || mail).body
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
class HtmlPartBody < Base
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
def part_body
|
|
33
|
+
mail.html_part ? mail.html_part.body : nil
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
class TextPartBody < Base
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def part_body
|
|
41
|
+
mail.text_part ? mail.text_part.body : nil
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
data/lib/email_spec/mail_ext.rb
CHANGED
|
@@ -5,11 +5,11 @@ module EmailSpec::MailExt
|
|
|
5
5
|
|
|
6
6
|
def default_part_body
|
|
7
7
|
# Calling to_str as we want the actual String object
|
|
8
|
-
HTMLEntities.new.decode(default_part.
|
|
8
|
+
HTMLEntities.new.decode(default_part.decoded.to_s.to_str)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def html
|
|
12
|
-
html_part ? html_part.
|
|
12
|
+
html_part ? html_part.decoded : nil
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
data/lib/email_spec/matchers.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require_relative 'extractors'
|
|
2
|
+
|
|
1
3
|
module EmailSpec
|
|
2
4
|
module Matchers
|
|
3
5
|
class EmailMatcher
|
|
@@ -128,7 +130,7 @@ module EmailSpec
|
|
|
128
130
|
|
|
129
131
|
def matches?(email)
|
|
130
132
|
@email = email
|
|
131
|
-
@actual_recipients = address_array{ email.
|
|
133
|
+
@actual_recipients = address_array { email[:bcc].formatted }.sort
|
|
132
134
|
@actual_recipients == @expected_email_addresses
|
|
133
135
|
end
|
|
134
136
|
|
|
@@ -162,7 +164,7 @@ module EmailSpec
|
|
|
162
164
|
|
|
163
165
|
def matches?(email)
|
|
164
166
|
@email = email
|
|
165
|
-
@actual_recipients = address_array { email.
|
|
167
|
+
@actual_recipients = address_array { email[:cc].formatted }.sort
|
|
166
168
|
@actual_recipients == @expected_email_addresses
|
|
167
169
|
end
|
|
168
170
|
|
|
@@ -274,6 +276,7 @@ module EmailSpec
|
|
|
274
276
|
|
|
275
277
|
def initialize(text)
|
|
276
278
|
@expected_text = text
|
|
279
|
+
@extractor = EmailSpec::Extractors::DefaultPartBody
|
|
277
280
|
end
|
|
278
281
|
|
|
279
282
|
def description
|
|
@@ -284,13 +287,23 @@ module EmailSpec
|
|
|
284
287
|
end
|
|
285
288
|
end
|
|
286
289
|
|
|
290
|
+
def in_html_part
|
|
291
|
+
@extractor = EmailSpec::Extractors::HtmlPartBody
|
|
292
|
+
self
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
def in_text_part
|
|
296
|
+
@extractor = EmailSpec::Extractors::TextPartBody
|
|
297
|
+
self
|
|
298
|
+
end
|
|
299
|
+
|
|
287
300
|
def matches?(email)
|
|
288
301
|
if @expected_text.is_a?(String)
|
|
289
|
-
@given_text = email.
|
|
302
|
+
@given_text = @extractor.new(email).call.to_s.gsub(/\s+/, " ")
|
|
290
303
|
@expected_text = @expected_text.gsub(/\s+/, " ")
|
|
291
304
|
@given_text.include?(@expected_text)
|
|
292
305
|
else
|
|
293
|
-
@given_text = email.
|
|
306
|
+
@given_text = @extractor.new(email).call.to_s
|
|
294
307
|
!!(@given_text =~ @expected_text)
|
|
295
308
|
end
|
|
296
309
|
end
|
|
@@ -358,7 +371,14 @@ module EmailSpec
|
|
|
358
371
|
alias negative_failure_message failure_message_when_negated
|
|
359
372
|
|
|
360
373
|
def mail_headers_hash(email_headers)
|
|
361
|
-
email_headers.fields.inject({})
|
|
374
|
+
email_headers.fields.inject({}) do |hash, field|
|
|
375
|
+
if field.field.class.const_defined?('FIELD_NAME')
|
|
376
|
+
hash[field.field.class::FIELD_NAME] = field.to_s
|
|
377
|
+
else
|
|
378
|
+
hash[field.field.class::NAME.downcase] = field.to_s
|
|
379
|
+
end
|
|
380
|
+
hash
|
|
381
|
+
end
|
|
362
382
|
end
|
|
363
383
|
end
|
|
364
384
|
|
data/lib/email_spec/version.rb
CHANGED
|
@@ -35,6 +35,14 @@ describe EmailSpec::MailExt do
|
|
|
35
35
|
email = Mail.new(:body => ActiveSupport::SafeBuffer.new("bacon & pancake"))
|
|
36
36
|
expect(email.default_part_body).to eq ("bacon & pancake")
|
|
37
37
|
end
|
|
38
|
+
|
|
39
|
+
it "decodes parts before return" do
|
|
40
|
+
email = Mail.new(:body => "hello\r\nquoted-printable")
|
|
41
|
+
email.content_transfer_encoding = 'quoted-printable'
|
|
42
|
+
|
|
43
|
+
expect(email.encoded).to include("hello\r\nquoted-printable=")
|
|
44
|
+
expect(email.default_part_body).to eq("hello\nquoted-printable")
|
|
45
|
+
end
|
|
38
46
|
end
|
|
39
47
|
|
|
40
48
|
describe "#html" do
|
|
@@ -137,7 +137,7 @@ describe EmailSpec::Matchers do
|
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
it "should not match when the email does not have a sender" do
|
|
140
|
-
email = Mail::Message.new(:from =>
|
|
140
|
+
email = Mail::Message.new(:from => "johnshow@yahoo.com")
|
|
141
141
|
expect(deliver_from("jimmy_bean@yahoo.com")).not_to match(email)
|
|
142
142
|
end
|
|
143
143
|
|
|
@@ -178,6 +178,12 @@ describe EmailSpec::Matchers do
|
|
|
178
178
|
expect(bcc_to("jimmy_bean@yahoo.com")).to match(email)
|
|
179
179
|
end
|
|
180
180
|
|
|
181
|
+
it "should match when the email is set to deliver to the specified name and address" do
|
|
182
|
+
email = Mail::Message.new(:bcc => "Jimmy Bean <jimmy_bean@yahoo.com>")
|
|
183
|
+
|
|
184
|
+
expect(bcc_to("Jimmy Bean <jimmy_bean@yahoo.com>")).to match(email)
|
|
185
|
+
end
|
|
186
|
+
|
|
181
187
|
it "should match when a list of emails is exact same as all of the email's recipients" do
|
|
182
188
|
email = Mail::Message.new(:bcc => ["james@yahoo.com", "karen@yahoo.com"])
|
|
183
189
|
|
|
@@ -214,6 +220,12 @@ describe EmailSpec::Matchers do
|
|
|
214
220
|
expect(cc_to("jimmy_bean@yahoo.com")).to match(email)
|
|
215
221
|
end
|
|
216
222
|
|
|
223
|
+
it "should match when the email is set to deliver to the specified name and address" do
|
|
224
|
+
email = Mail::Message.new(:cc => "Jimmy Bean <jimmy_bean@yahoo.com>")
|
|
225
|
+
|
|
226
|
+
expect(cc_to("Jimmy Bean <jimmy_bean@yahoo.com>")).to match(email)
|
|
227
|
+
end
|
|
228
|
+
|
|
217
229
|
it "should match when a list of emails is exact same as all of the email's recipients" do
|
|
218
230
|
email = Mail::Message.new(:cc => ["james@yahoo.com", "karen@yahoo.com"])
|
|
219
231
|
|
|
@@ -454,6 +466,106 @@ describe EmailSpec::Matchers do
|
|
|
454
466
|
end
|
|
455
467
|
end
|
|
456
468
|
|
|
469
|
+
describe "#have_body_text", ".in_html_part" do
|
|
470
|
+
describe 'when html part is definded in mulitpart' do
|
|
471
|
+
it 'should match when the body matches regexp' do
|
|
472
|
+
email = Mail.new do
|
|
473
|
+
html_part do
|
|
474
|
+
body 'This is html'
|
|
475
|
+
end
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
expect(have_body_text(/This is html/).in_html_part).to match(email)
|
|
479
|
+
end
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
describe 'when text part is definded in mulitpart' do
|
|
483
|
+
it 'should not look at text part' do
|
|
484
|
+
email = Mail.new do
|
|
485
|
+
text_part do
|
|
486
|
+
body 'This is text'
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
expect(have_body_text(/This is text/).in_html_part).not_to match(email)
|
|
491
|
+
end
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
describe 'when html and text parts are definded in mulitpart' do
|
|
495
|
+
it 'should look at html part' do
|
|
496
|
+
email = Mail.new do
|
|
497
|
+
html_part do
|
|
498
|
+
body 'This is html'
|
|
499
|
+
end
|
|
500
|
+
text_part do
|
|
501
|
+
body 'This is text'
|
|
502
|
+
end
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
expect(have_body_text(/This is html/).in_html_part).to match(email)
|
|
506
|
+
expect(have_body_text(/This is text/).in_html_part).not_to match(email)
|
|
507
|
+
end
|
|
508
|
+
end
|
|
509
|
+
|
|
510
|
+
describe 'when nothing is defined in mulitpart' do
|
|
511
|
+
it 'should not look at any parts' do
|
|
512
|
+
email = Mail.new(body: 'This is body')
|
|
513
|
+
|
|
514
|
+
expect(have_body_text(/This is body/).in_html_part).not_to match(email)
|
|
515
|
+
end
|
|
516
|
+
end
|
|
517
|
+
end
|
|
518
|
+
|
|
519
|
+
describe "#have_body_text", ".in_text_part" do
|
|
520
|
+
describe 'when text part is definded in mulitpart' do
|
|
521
|
+
it 'should match when the body matches regexp' do
|
|
522
|
+
email = Mail.new do
|
|
523
|
+
text_part do
|
|
524
|
+
body 'This is text'
|
|
525
|
+
end
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
expect(have_body_text(/This is text/).in_text_part).to match(email)
|
|
529
|
+
end
|
|
530
|
+
end
|
|
531
|
+
|
|
532
|
+
describe 'when text and html parts are definded in mulitpart' do
|
|
533
|
+
it 'should look at text part' do
|
|
534
|
+
email = Mail.new do
|
|
535
|
+
text_part do
|
|
536
|
+
body 'This is text'
|
|
537
|
+
end
|
|
538
|
+
|
|
539
|
+
html_part do
|
|
540
|
+
body 'This is html'
|
|
541
|
+
end
|
|
542
|
+
end
|
|
543
|
+
|
|
544
|
+
expect(have_body_text(/This is text/).in_text_part).to match(email)
|
|
545
|
+
expect(have_body_text(/This is html/).in_text_part).not_to match(email)
|
|
546
|
+
end
|
|
547
|
+
end
|
|
548
|
+
|
|
549
|
+
describe 'when html part is definded in mulitpart' do
|
|
550
|
+
it 'should not look at html part' do
|
|
551
|
+
email = Mail.new do
|
|
552
|
+
html_part do
|
|
553
|
+
body "This is html"
|
|
554
|
+
end
|
|
555
|
+
end
|
|
556
|
+
|
|
557
|
+
expect(have_body_text(/This is html/).in_text_part).not_to match(email)
|
|
558
|
+
end
|
|
559
|
+
end
|
|
560
|
+
|
|
561
|
+
describe 'when nothing is defined in mulitpart' do
|
|
562
|
+
it 'should not look at any parts' do
|
|
563
|
+
email = Mail.new(body: 'This is body')
|
|
564
|
+
|
|
565
|
+
expect(have_body_text(/This is body/).in_text_part).not_to match(email)
|
|
566
|
+
end
|
|
567
|
+
end
|
|
568
|
+
end
|
|
457
569
|
describe "#have_header" do
|
|
458
570
|
describe "when regexps are used" do
|
|
459
571
|
it "should match when header matches passed in regexp" do
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: email_spec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Mabey
|
|
8
8
|
- Aaron Gibralter
|
|
9
9
|
- Mischa Fierer
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: htmlentities
|
|
@@ -30,16 +30,22 @@ dependencies:
|
|
|
30
30
|
name: launchy
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
|
32
32
|
requirements:
|
|
33
|
-
- - "
|
|
33
|
+
- - ">="
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
35
|
version: '2.1'
|
|
36
|
+
- - "<"
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '4.0'
|
|
36
39
|
type: :runtime
|
|
37
40
|
prerelease: false
|
|
38
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
39
42
|
requirements:
|
|
40
|
-
- - "
|
|
43
|
+
- - ">="
|
|
41
44
|
- !ruby/object:Gem::Version
|
|
42
45
|
version: '2.1'
|
|
46
|
+
- - "<"
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: '4.0'
|
|
43
49
|
- !ruby/object:Gem::Dependency
|
|
44
50
|
name: mail
|
|
45
51
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -82,20 +88,6 @@ dependencies:
|
|
|
82
88
|
- - "~>"
|
|
83
89
|
- !ruby/object:Gem::Version
|
|
84
90
|
version: 1.3.17
|
|
85
|
-
- !ruby/object:Gem::Dependency
|
|
86
|
-
name: actionmailer
|
|
87
|
-
requirement: !ruby/object:Gem::Requirement
|
|
88
|
-
requirements:
|
|
89
|
-
- - "~>"
|
|
90
|
-
- !ruby/object:Gem::Version
|
|
91
|
-
version: '4.2'
|
|
92
|
-
type: :development
|
|
93
|
-
prerelease: false
|
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
95
|
-
requirements:
|
|
96
|
-
- - "~>"
|
|
97
|
-
- !ruby/object:Gem::Version
|
|
98
|
-
version: '4.2'
|
|
99
91
|
- !ruby/object:Gem::Dependency
|
|
100
92
|
name: rack-test
|
|
101
93
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -179,7 +171,6 @@ files:
|
|
|
179
171
|
- README.md
|
|
180
172
|
- Rakefile
|
|
181
173
|
- examples/rails4_root/Gemfile
|
|
182
|
-
- examples/rails4_root/Gemfile.lock
|
|
183
174
|
- examples/rails4_root/README
|
|
184
175
|
- examples/rails4_root/Rakefile
|
|
185
176
|
- examples/rails4_root/app/controllers/application_controller.rb
|
|
@@ -223,7 +214,6 @@ files:
|
|
|
223
214
|
- examples/rails4_root/db/migrate/20141119224309_add_queue_to_delayed_jobs.rb
|
|
224
215
|
- examples/rails4_root/db/schema.rb
|
|
225
216
|
- examples/rails4_root/db/seeds.rb
|
|
226
|
-
- examples/rails4_root/db/test.sqlite3
|
|
227
217
|
- examples/rails4_root/doc/README_FOR_APP
|
|
228
218
|
- examples/rails4_root/features/attachments.feature
|
|
229
219
|
- examples/rails4_root/features/delayed_job.feature
|
|
@@ -238,8 +228,6 @@ files:
|
|
|
238
228
|
- examples/rails4_root/lib/notifier_job.rb
|
|
239
229
|
- examples/rails4_root/lib/tasks/cucumber.rake
|
|
240
230
|
- examples/rails4_root/lib/tasks/rspec.rake
|
|
241
|
-
- examples/rails4_root/log/development.log
|
|
242
|
-
- examples/rails4_root/log/test.log
|
|
243
231
|
- examples/rails4_root/public/404.html
|
|
244
232
|
- examples/rails4_root/public/422.html
|
|
245
233
|
- examples/rails4_root/public/500.html
|
|
@@ -262,7 +250,6 @@ files:
|
|
|
262
250
|
- examples/rails4_root/test/mailers/user_mailer_spec_test.rb
|
|
263
251
|
- examples/rails4_root/test/test_helper.rb
|
|
264
252
|
- examples/sinatra_root/Gemfile
|
|
265
|
-
- examples/sinatra_root/Gemfile.lock
|
|
266
253
|
- examples/sinatra_root/config.ru
|
|
267
254
|
- examples/sinatra_root/features/errors.feature
|
|
268
255
|
- examples/sinatra_root/features/example.feature
|
|
@@ -283,6 +270,7 @@ files:
|
|
|
283
270
|
- lib/email_spec/deliveries.rb
|
|
284
271
|
- lib/email_spec/email_viewer.rb
|
|
285
272
|
- lib/email_spec/errors.rb
|
|
273
|
+
- lib/email_spec/extractors.rb
|
|
286
274
|
- lib/email_spec/helpers.rb
|
|
287
275
|
- lib/email_spec/mail_ext.rb
|
|
288
276
|
- lib/email_spec/matchers.rb
|
|
@@ -301,7 +289,7 @@ homepage: http://github.com/email-spec/email-spec/
|
|
|
301
289
|
licenses:
|
|
302
290
|
- MIT
|
|
303
291
|
metadata: {}
|
|
304
|
-
post_install_message:
|
|
292
|
+
post_install_message:
|
|
305
293
|
rdoc_options: []
|
|
306
294
|
require_paths:
|
|
307
295
|
- lib
|
|
@@ -316,9 +304,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
316
304
|
- !ruby/object:Gem::Version
|
|
317
305
|
version: '0'
|
|
318
306
|
requirements: []
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
signing_key:
|
|
307
|
+
rubygems_version: 3.5.10
|
|
308
|
+
signing_key:
|
|
322
309
|
specification_version: 4
|
|
323
310
|
summary: Easily test email in RSpec, Cucumber or Minitest
|
|
324
311
|
test_files: []
|