Skip to content

Commit 202fdb3

Browse files
andyw8eliotsykes
authored andcommitted
Avoid nested expectations
A nested expectation adds unnecessary complexity.
1 parent 891fb85 commit 202fdb3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spec/models/subscription_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@
168168
it "doesn't send an email if the subscription can't be created" do
169169
blank_email = ""
170170
expect do
171-
expect do
172-
Subscription.create_and_request_confirmation(email: blank_email)
173-
end.to raise_error ActiveRecord::RecordInvalid
174-
end.not_to change { ActionMailer::Base.deliveries.size }
171+
Subscription.create_and_request_confirmation(email: blank_email)
172+
end.to raise_error
173+
174+
expect(ActionMailer::Base.deliveries).to be_empty
175175
end
176176

177177
it "raises an error if the emailing fails" do

0 commit comments

Comments
 (0)