Skip to content

Commit

Permalink
Fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
avelicka committed Nov 12, 2024
1 parent a9e4239 commit 6e37bb9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions spec/lib/chained_job/process_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
double(
process: ->() {},
class: double(perform_later: ->(args, worker_id, job_tag) {}),
try: ->(method_name) { handle_retry? },
try: handle_retry?
)
end
let(:job_arguments_key) { 'DummyJob' }
Expand Down Expand Up @@ -47,18 +47,17 @@
expect(job_instance.class).not_to receive(:perform_later)

expect { subject }.to raise_error('Runtime error')

expect([ChainedJob.redis.call(:lpop, redis_key)]).not_to eq(serialized_array_of_arguments)
end

context 'when handle retry is enabled' do
let(:handle_retry?) { true }

it 'pushes argument back and raises error' do
expect(ChainedJob.redis)
.to receive(:call)
.with(:rpush, redis_key, ChainedJob::Helpers.serialize([101])).and_call_original

# subject
expect { subject }.to raise_error('Runtime error')

expect([ChainedJob.redis.call(:lpop, redis_key)]).to eq(serialized_array_of_arguments)
end
end
end
Expand Down

0 comments on commit 6e37bb9

Please sign in to comment.