Skip to content

Instantly share code, notes, and snippets.

@josemrb
Created April 9, 2018 14:46
Show Gist options
  • Save josemrb/f97d40eca58747b53fc63d73f4970ee0 to your computer and use it in GitHub Desktop.
Save josemrb/f97d40eca58747b53fc63d73f4970ee0 to your computer and use it in GitHub Desktop.
describe ApiJob, type: :job do
include ActiveJob::TestHelper
subject(:job) { described_class.perform_later() }
it 'handles status 429' do
allow(ApiClient).to receive(:make_request).and_raise(RestClient::RequestFailed)
perform_enqueued_jobs do
expect_any_instance_of(described_class).to receive(:retry_job).with(wait: 15.seconds)
job
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment