Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-10-06 13:07:11 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-11-06 13:04:09 +0300
commite2828a60679495d716ed3824959794f4d5fbf5bb (patch)
tree077bd7c2a3e9b4d289f2ec5278fcd30be4603a3d /spec/models/commit_status_spec.rb
parent503f21367051c18412d6bdf3d4586eaddaf69087 (diff)
Use existing pipeline stage if stage already exists
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r--spec/models/commit_status_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 6c94f463a6a..c536dab2681 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -499,6 +499,29 @@ describe CommitStatus do
end
end
+ context 'when commit status does not have stage but it exists' do
+ let!(:stage) do
+ create(:ci_stage_entity, project: project,
+ pipeline: pipeline,
+ name: 'test')
+ end
+
+ let(:commit_status) do
+ create(:commit_status, project: project,
+ pipeline: pipeline,
+ name: 'rspec',
+ stage: 'test',
+ status: :success)
+ end
+
+ it 'uses existing stage' do
+ expect { commit_status }.not_to change { Ci::Stage.count }
+
+ expect(commit_status.stage_id).to eq stage.id
+ expect(stage.reload.status).to eq commit_status.status
+ end
+ end
+
context 'when commit status is being imported' do
let(:commit_status) do
create(:commit_status, name: 'rspec', stage: 'test', importing: true)