Skip to content

Commit

Permalink
tests: specific context to the first failure
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorFroehner committed Oct 28, 2024
1 parent 996d423 commit de3b111
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions spec/sidekiq/silent_retry/server_middleware_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,36 @@
-> { raise error_class, "some message" }
end
let(:job_payload) do
payload = {
{
"retry_count" => retry_count,
"retry" => 2,
"silent_retry" => silent_retry
}
payload["retry_count"] = retry_count if retry_count
payload
end

context 'in the first failure' do
let(:job_payload) do
{
"retry" => 2,
"silent_retry" => silent_retry
}
end

context 'with silent retry enabled' do
let(:silent_retry) { true }

it 'raises the silent error' do
expect { subject }.to raise_error(Sidekiq::SilentRetry.silent_retry_error_class, "some message")
end
end

context 'with silent retry disabled' do
let(:silent_retry) { false }

it 'raises the error' do
expect { subject }.to raise_error(StandardError, "some message")
end
end
end

context "when silent retry is off" do
Expand Down

0 comments on commit de3b111

Please sign in to comment.