ConfirmOauth.email_confirmation(user).deliver_now
- expect(ConfirmOauth.email_confirmation(user)).to receive(:deliver_now)
- expect(ConfirmOauth).to receive(:email_confirmation).with(user)
let(:confirm_oauth) { double deliver_now: nil }
before do
allow(ConfirmOauth).to receive(:email_confirmation)
.and_return confirm_oauth
end
subject! { do_something_that_calls_mailer }
it do
expect(ConfirmOauth).to have_received(:email_confirmation).with user
expect(confirm_oauth).to have_received :deliver_now
end