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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e0a37bd9d3d9eaa30f18b427930baa52d8b895b50d4d7b831650d621a9c955e
4
- data.tar.gz: 4193090888bee1123f782507dc6c8496b9bca6ff0aea94612624a48f9d45d65b
3
+ metadata.gz: 45b6ba1ef662e1569eca4b9ec1dbaf0425b26cdcbe5e618dfa6e47c07473cad7
4
+ data.tar.gz: 1ac72ff510036911b33419ba25069a1116ce7558f6ffef4531e05c9745808019
5
5
  SHA512:
6
- metadata.gz: 97b61a1089f4c29bdcfffca000405a5d66bc2430dca4c9e293090cea5a12ebae9bacc108c3663b9a3961a5f955d59a0870a28c53a19d0782ed9d66ff6cfea15a
7
- data.tar.gz: b38641514a7ceace6ea75f178865dffd9b910cebbc2eb28fea8c1ea3a7f64786e248900f34dd881f722c251ceb12e5f52f071257cf10b15eb316ad1a2e9e9427
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
- [![Build Status](https://secure.travis-ci.org/email-spec/email-spec.svg)](http://travis-ci.org/email-spec/email-spec)
1
+ ## Email Spec
2
2
 
3
- ## Email Spec
3
+ [![CI](https://github.com/email-spec/email-spec/actions/workflows/main.yml/badge.svg)](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
 
@@ -130,7 +130,7 @@ module EmailSpec
130
130
 
131
131
  def matches?(email)
132
132
  @email = email
133
- @actual_recipients = address_array { email[:bcc].formatted }.sort
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].formatted }.sort
167
+ @actual_recipients = address_array { email[:cc]&.formatted }.sort
168
168
  @actual_recipients == @expected_email_addresses
169
169
  end
170
170
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EmailSpec
4
- VERSION = "2.3.0"
4
+ VERSION = "2.3.1"
5
5
  end
@@ -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 {"content-type"=>"text/html"}')
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 {"content-type"=>"text/html"}')
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 {"content-type"=>"text/html"}')
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 {:content_type=>"text/html"}'
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.0
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: 2024-07-22 00:00:00.000000000 Z
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.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.3
28
+ version: '4.3'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: launchy
31
31
  requirement: !ruby/object:Gem::Requirement