diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-03-30 16:50:23 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-03-30 16:50:23 +0900 |
commit | 1a7d9346682af5c496d0a974180eb4054ccae8af (patch) | |
tree | b5cab7c5f961fa5a5f02cd5497fb084200e74451 /spec/services | |
parent | 0ce0732629dba5a830c259d84b864179c430502b (diff) | |
download | gitlab-ce-1a7d9346682af5c496d0a974180eb4054ccae8af.tar.gz |
Fix wrong error handling in update page service
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/projects/update_pages_service_spec.rb | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index 934106627a9..0c8c05168ce 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -169,10 +169,41 @@ describe Projects::UpdatePagesService do end it 'raises an error' do - expect { execute }.to raise_error(SocketError) + execute build.reload - expect(build.artifacts?).to eq(true) + expect(deploy_status).to be_failed + expect(build.artifacts?).to be_truthy + end + end + + context 'when failed to extract zip artifacts' do + before do + allow_any_instance_of(described_class) + .to receive(:extract_zip_archive!) + .and_raise(Projects::UpdatePagesService::FailedToExtractError) + end + + it 'raises an error' do + execute + + build.reload + expect(deploy_status).to be_failed + expect(build.artifacts?).to be_truthy + end + end + + context 'when missing artifacts metadata' do + before do + allow(build).to receive(:artifacts_metadata?).and_return(false) + end + + it 'raises an error' do + execute + + build.reload + expect(deploy_status).to be_failed + expect(build.artifacts?).to be_falsey end end end |