Skip to content

Instantly share code, notes, and snippets.

@kumar1202
Last active March 21, 2020 09:41
Show Gist options
  • Save kumar1202/a8d740621ab9d97ac2a11bb787c13652 to your computer and use it in GitHub Desktop.
Save kumar1202/a8d740621ab9d97ac2a11bb787c13652 to your computer and use it in GitHub Desktop.
require 'rails_helper'
RSpec.describe SendEmailJob, type: :job do
let(:Mailer) { create(:Mailer) }
let(:email) { "test@go-jek.com" }
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