email_spec 2.3.0 → 2.3.1
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 +7 -0
- data/README.md +2 -2
- data/lib/email_spec/matchers.rb +2 -2
- data/lib/email_spec/version.rb +1 -1
- data/spec/email_spec/matchers_spec.rb +20 -4
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 45b6ba1ef662e1569eca4b9ec1dbaf0425b26cdcbe5e618dfa6e47c07473cad7
|
|
4
|
+
data.tar.gz: 1ac72ff510036911b33419ba25069a1116ce7558f6ffef4531e05c9745808019
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6fd41035b3fa6644ae8789aaa11409f0ddbc8befe6f39ec1ed3672452a819995b2b8f3f316bbbdfbdbbc18496c2462bd08f4cb50ef28a7a7a86f19df103d0cf
|
|
7
|
+
data.tar.gz: 19204b91df3bdc3645d9481a014c7fed7ec780070748a756f6175e77273c19587326e0f17707ed6889e1d613470e2797ca7bc146ad6d4685ff4cb2685468ab6d
|
data/Changelog.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 2.3.1 2026-03-21
|
|
2
|
+
|
|
3
|
+
* [Fix CC/BCC failing on nil `.cc` or `.bcc` values](https://github.com/email-spec/email-spec/pull/229)
|
|
4
|
+
* [Loosen dependency lock on htmlentities](https://github.com/email-spec/email-spec/pull/230)
|
|
5
|
+
* [Drop EOL Rails versions from appraisals, update CI matrix, and version bump](https://github.com/email-spec/email-spec/pull/231)
|
|
6
|
+
* [Update CI Badge in README.md](https://github.com/email-spec/email-spec/commit/eb2844f)
|
|
7
|
+
|
|
1
8
|
## 2.3.0 2024-07-21
|
|
2
9
|
|
|
3
10
|
* [Support the specified name and address for bcc_to and cc_to matchers](https://github.com/email-spec/email-spec/pull/212)
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
## Email Spec
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/email-spec/email-spec/actions/workflows/main.yml)
|
|
4
4
|
|
|
5
5
|
A collection of matchers for `RSpec`, `MiniTest` and `Cucumber` steps to make testing emails go smoothly.
|
|
6
6
|
|
data/lib/email_spec/matchers.rb
CHANGED
|
@@ -130,7 +130,7 @@ module EmailSpec
|
|
|
130
130
|
|
|
131
131
|
def matches?(email)
|
|
132
132
|
@email = email
|
|
133
|
-
@actual_recipients = address_array { email[:bcc]
|
|
133
|
+
@actual_recipients = address_array { email[:bcc]&.formatted }.sort
|
|
134
134
|
@actual_recipients == @expected_email_addresses
|
|
135
135
|
end
|
|
136
136
|
|
|
@@ -164,7 +164,7 @@ module EmailSpec
|
|
|
164
164
|
|
|
165
165
|
def matches?(email)
|
|
166
166
|
@email = email
|
|
167
|
-
@actual_recipients = address_array { email[:cc]
|
|
167
|
+
@actual_recipients = address_array { email[:cc]&.formatted }.sort
|
|
168
168
|
@actual_recipients == @expected_email_addresses
|
|
169
169
|
end
|
|
170
170
|
|
data/lib/email_spec/version.rb
CHANGED
|
@@ -204,6 +204,11 @@ describe EmailSpec::Matchers do
|
|
|
204
204
|
expect(bcc_to(user)).to match(email)
|
|
205
205
|
end
|
|
206
206
|
|
|
207
|
+
it "should bcc to nobody when no BCC is specified" do
|
|
208
|
+
email = Mail::Message.new(to: "jimmy_bean@yahoo.com")
|
|
209
|
+
expect(bcc_to("jimmy_bean@yahoo.com")).not_to match(email)
|
|
210
|
+
end
|
|
211
|
+
|
|
207
212
|
it "should bcc to nobody when the email does not perform deliveries" do
|
|
208
213
|
email = Mail::Message.new(:bcc => "jimmy_bean@yahoo.com")
|
|
209
214
|
email.perform_deliveries = false
|
|
@@ -246,6 +251,11 @@ describe EmailSpec::Matchers do
|
|
|
246
251
|
expect(cc_to(user)).to match(email)
|
|
247
252
|
end
|
|
248
253
|
|
|
254
|
+
it "should cc to nobody when no CC is specified" do
|
|
255
|
+
email = Mail::Message.new(to: "jimmy_bean@yahoo.com")
|
|
256
|
+
expect(cc_to("jimmy_bean@yahoo.com")).not_to match(email)
|
|
257
|
+
end
|
|
258
|
+
|
|
249
259
|
it "should cc to nobody when the email does not perform deliveries" do
|
|
250
260
|
email = Mail::Message.new(to: "jimmy_bean@yahoo.com")
|
|
251
261
|
email.perform_deliveries = false
|
|
@@ -587,14 +597,14 @@ describe EmailSpec::Matchers do
|
|
|
587
597
|
matcher = have_header(:content_type, /bar/)
|
|
588
598
|
matcher.matches?(Mail::Message.new(:content_type => "text/html"))
|
|
589
599
|
|
|
590
|
-
expect(matcher_failure_message(matcher)).to eq('expected the headers to include \'content_type\' with a value matching /bar/ but they were
|
|
600
|
+
expect(matcher_failure_message(matcher)).to eq('expected the headers to include \'content_type\' with a value matching /bar/ but they were ' + actual_content_type)
|
|
591
601
|
end
|
|
592
602
|
|
|
593
603
|
it "should offer helpful negative failing messages" do
|
|
594
604
|
matcher = have_header(:content_type, /text/)
|
|
595
605
|
matcher.matches?(Mail::Message.new(:content_type => "text/html"))
|
|
596
606
|
|
|
597
|
-
expect(matcher_failure_message_when_negated(matcher)).to eq('expected the headers not to include \'content_type\' with a value matching /text/ but they were
|
|
607
|
+
expect(matcher_failure_message_when_negated(matcher)).to eq('expected the headers not to include \'content_type\' with a value matching /text/ but they were ' + actual_content_type)
|
|
598
608
|
end
|
|
599
609
|
end
|
|
600
610
|
|
|
@@ -618,15 +628,21 @@ describe EmailSpec::Matchers do
|
|
|
618
628
|
matcher = have_header(:content_type, 'text')
|
|
619
629
|
matcher.matches?(Mail::Message.new(:content_type => "text/html"))
|
|
620
630
|
|
|
621
|
-
expect(matcher_failure_message(matcher)).to eq('expected the headers to include \'content_type: text\' but they were
|
|
631
|
+
expect(matcher_failure_message(matcher)).to eq('expected the headers to include \'content_type: text\' but they were ' + actual_content_type)
|
|
622
632
|
end
|
|
623
633
|
|
|
624
634
|
it "should offer helpful negative failing messages" do
|
|
625
635
|
matcher = have_header(:content_type, 'text/html')
|
|
626
636
|
matcher.matches?(Mail::Message.new(:content_type => "text/html"))
|
|
627
637
|
|
|
628
|
-
matcher_failure_message_when_negated(matcher) == 'expected the headers not to include \'content_type: text/html\' but they were
|
|
638
|
+
matcher_failure_message_when_negated(matcher) == 'expected the headers not to include \'content_type: text/html\' but they were ' + actual_content_type
|
|
629
639
|
end
|
|
630
640
|
end
|
|
641
|
+
|
|
642
|
+
def actual_content_type
|
|
643
|
+
# TODO: Ruby 3.4 changed hash output format to include spaces
|
|
644
|
+
# Whenever support for 3.3 and earlier is dropped, this can convert back to a string
|
|
645
|
+
{'content-type' => 'text/html' }.inspect
|
|
646
|
+
end
|
|
631
647
|
end
|
|
632
648
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: email_spec
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.3.
|
|
4
|
+
version: 2.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Mabey
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2026-03-21 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: htmlentities
|
|
@@ -18,14 +18,14 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - "~>"
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 4.3
|
|
21
|
+
version: '4.3'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
25
|
requirements:
|
|
26
26
|
- - "~>"
|
|
27
27
|
- !ruby/object:Gem::Version
|
|
28
|
-
version: 4.3
|
|
28
|
+
version: '4.3'
|
|
29
29
|
- !ruby/object:Gem::Dependency
|
|
30
30
|
name: launchy
|
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|