test: fix warning about classes already defined by another spec
This commit is contained in:
parent
92661d074d
commit
e591851b79
1 changed files with 11 additions and 11 deletions
|
@ -1,11 +1,17 @@
|
||||||
RSpec.shared_examples 'a job retrying transient errors' do |job_class = described_class|
|
RSpec.shared_examples 'a job retrying transient errors' do |job_class = described_class|
|
||||||
context 'when a transient network error is raised' do
|
ExconErrorJob = Class.new(job_class) do
|
||||||
ExconErrorJob = Class.new(job_class) do
|
def perform
|
||||||
def perform
|
raise Excon::Error::InternalServerError, 'msg'
|
||||||
raise Excon::Error::InternalServerError, 'msg'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
end if !defined?(ExconErrorJob)
|
||||||
|
|
||||||
|
StandardErrorJob = Class.new(job_class) do
|
||||||
|
def perform
|
||||||
|
raise StandardError
|
||||||
|
end
|
||||||
|
end if !defined?(StandardErrorJob)
|
||||||
|
|
||||||
|
context 'when a transient network error is raised' do
|
||||||
it 'makes 5 attempts before raising the exception up' do
|
it 'makes 5 attempts before raising the exception up' do
|
||||||
assert_performed_jobs 5 do
|
assert_performed_jobs 5 do
|
||||||
ExconErrorJob.perform_later rescue Excon::Error::InternalServerError
|
ExconErrorJob.perform_later rescue Excon::Error::InternalServerError
|
||||||
|
@ -14,12 +20,6 @@ RSpec.shared_examples 'a job retrying transient errors' do |job_class = describe
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when another type of error is raised' do
|
context 'when another type of error is raised' do
|
||||||
StandardErrorJob = Class.new(job_class) do
|
|
||||||
def perform
|
|
||||||
raise StandardError
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'makes only 1 attempt before raising the exception up' do
|
it 'makes only 1 attempt before raising the exception up' do
|
||||||
assert_performed_jobs 1 do
|
assert_performed_jobs 1 do
|
||||||
StandardErrorJob.perform_later rescue StandardError
|
StandardErrorJob.perform_later rescue StandardError
|
||||||
|
|
Loading…
Reference in a new issue