From f617bd76907e45d9103d768a02fbccb451524b35 Mon Sep 17 00:00:00 2001
From: Timothy Andrew <mail@timothyandrew.net>
Date: Tue, 5 Jul 2016 10:20:32 +0530
Subject: [PATCH] Assert against `ActionMailer::Base.deliveries` relatively.

- Look for a `change` in its size rather than asserting against an
  actual size.

- This previously failed because another spec had an email in
  `ActionMailer::Base.deliveries`, which failed this `be_nil` assertion.
---
 spec/controllers/registrations_controller_spec.rb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index 209fa37d97d..026f41c926b 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -14,8 +14,7 @@ describe RegistrationsController do
       before { allow_any_instance_of(ApplicationSetting).to receive(:send_user_confirmation_email).and_return(false) }
 
       it 'logs user in directly' do
-        post(:create, user_params)
-        expect(ActionMailer::Base.deliveries.last).to be_nil
+        expect { post(:create, user_params) }.not_to change{ ActionMailer::Base.deliveries.size }
         expect(subject.current_user).not_to be_nil
       end
     end
-- 
GitLab