Fixed spec tests

This commit is contained in:
Mahima Singh 2025-12-04 16:19:34 +05:30
parent 9e75854ec4
commit 8372ea824f

View file

@ -426,39 +426,39 @@ EOT
end end
end end
describe '#is_permanent_error?' do describe '#permanent_error?' do
before do before do
expect(subject).not_to be_nil expect(subject).not_to be_nil
end end
it 'identifies template not found errors as permanent' do it 'identifies template not found errors as permanent' do
expect(subject.is_permanent_error?('template not found', 'RuntimeError')).to be(true) expect(subject.permanent_error?('template not found', 'RuntimeError')).to be(true)
end end
it 'identifies invalid path errors as permanent' do it 'identifies invalid path errors as permanent' do
expect(subject.is_permanent_error?('invalid path specified', 'ArgumentError')).to be(true) expect(subject.permanent_error?('invalid path specified', 'ArgumentError')).to be(true)
end end
it 'identifies permission denied errors as permanent' do it 'identifies permission denied errors as permanent' do
expect(subject.is_permanent_error?('permission denied', 'SecurityError')).to be(true) expect(subject.permanent_error?('permission denied', 'SecurityError')).to be(true)
end end
it 'identifies ArgumentError class as permanent' do it 'identifies ArgumentError class as permanent' do
expect(subject.is_permanent_error?('some argument error', 'ArgumentError')).to be(true) expect(subject.permanent_error?('some argument error', 'ArgumentError')).to be(true)
end end
it 'identifies network errors as transient' do it 'identifies network errors as transient' do
expect(subject.is_permanent_error?('connection timeout', 'Timeout::Error')).to be(false) expect(subject.permanent_error?('connection timeout', 'Timeout::Error')).to be(false)
end end
it 'identifies socket errors as transient' do it 'identifies socket errors as transient' do
expect(subject.is_permanent_error?('connection refused', 'Errno::ECONNREFUSED')).to be(false) expect(subject.permanent_error?('connection refused', 'Errno::ECONNREFUSED')).to be(false)
end end
it 'returns false for nil inputs' do it 'returns false for nil inputs' do
expect(subject.is_permanent_error?(nil, nil)).to be(false) expect(subject.permanent_error?(nil, nil)).to be(false)
expect(subject.is_permanent_error?('error', nil)).to be(false) expect(subject.permanent_error?('error', nil)).to be(false)
expect(subject.is_permanent_error?(nil, 'Error')).to be(false) expect(subject.permanent_error?(nil, 'Error')).to be(false)
end end
end end