Last active
March 21, 2020 09:41
-
-
Save kumar1202/a8d740621ab9d97ac2a11bb787c13652 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe SendEmailJob, type: :job do | |
let(:Mailer) { create(:Mailer) } | |
let(:email) { "[email protected]" } | |
let(:body) { "Hello World" } | |
it 'enqueues itself on default queue' do | |
ActiveJob::Base.queue_adapter = :test | |
expect { SendEmailJob.perform_async(email, body) } | |
.to have_enqueued_job(SendEmailJob).on_queue('default') | |
end | |
describe '#perform' do | |
it 'sends a given mail with to the given id' do | |
expect(Mailer).to receive(send).with(body, email) | |
SendEmailJob.perform_async(body, email) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment