Skip to content

Commit e579b77

Browse files
committed
Undef the defined negated matcher
1 parent ecbacb5 commit e579b77

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

spec/rspec/rails/matchers/send_email_spec.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_email
3535
}.to send_email
3636
end
3737

38-
it "with with to_not" do
38+
it "with to_not" do
3939
expect {
4040
mailer.test_email.deliver_now
4141
}.to_not send_email(
@@ -119,7 +119,12 @@ def test_email
119119
end
120120

121121
context "with a custom negated version defined" do
122-
before { RSpec::Matchers.define_negated_matcher :not_send_email, :send_email }
122+
around do |example|
123+
RSpec::Matchers.define_negated_matcher :not_send_email, :send_email
124+
example.run
125+
ensure
126+
undef not_send_email
127+
end
123128

124129
it "works with a negated version" do
125130
expect {

0 commit comments

Comments
 (0)