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.
This commit is contained in:
Timothy Andrew 2016-07-05 10:20:32 +05:30
parent 0d68e19909
commit f617bd7690

View file

@ -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