diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-15 15:10:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-15 15:10:16 +0300 |
commit | c70fec25f88e1f1866c6b3d91de8587bdad59391 (patch) | |
tree | 0e869771cd4702cfe9711fca921e7b3a124c91dc /spec/services/projects | |
parent | 340f85512a4b4fa1ffd558ecaf64fef2eec8cc87 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/update_pages_service_spec.rb | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index a250be0c94f..6c767876d05 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -282,27 +282,28 @@ RSpec.describe Projects::UpdatePagesService, feature_category: :pages do end end - shared_examples 'successfully deploys' do - it 'succeeds' do - expect do - expect(service.execute[:status]).to eq(:success) - end.to change { project.pages_deployments.count }.by(1) + it 'creates a new pages deployment and mark it as deployed' do + expect do + expect(service.execute[:status]).to eq(:success) + end.to change { project.pages_deployments.count }.by(1) - deployment = project.pages_deployments.last - expect(deployment.ci_build_id).to eq(build.id) - end + deployment = project.pages_deployments.last + expect(deployment.ci_build_id).to eq(build.id) end - include_examples 'successfully deploys' - context 'when old deployment present' do + let!(:old_build) { create(:ci_build, name: 'pages', pipeline: old_pipeline, ref: 'HEAD') } + let!(:old_deployment) { create(:pages_deployment, ci_build: old_build, project: project) } + before do - old_build = create(:ci_build, name: 'pages', pipeline: old_pipeline, ref: 'HEAD') - old_deployment = create(:pages_deployment, ci_build: old_build, project: project) project.update_pages_deployment!(old_deployment) end - include_examples 'successfully deploys' + it 'deactivates old deployments' do + expect(service.execute[:status]).to eq(:success) + + expect(old_deployment.reload.deleted_at).not_to be_nil + end end context 'when newer deployment present' do |