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-07-04 17:41:33 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-04 17:41:33 +0300
commitb3ee172b4ee6fd22ebf3705edf6762a9dd777cdc (patch)
treea0dfe7a53af091591a27444ad0f904ae9e75db26 /spec/models/commit_status_spec.rb
parent22d8460b5d9926d7608d23aeb58e20d9035efa92 (diff)
Add a workaround for a tmp job -> stage relation
We still didn't migrate `ci_builds.stage_id`, so we can't use a belongs_to association. We also have `ci_builds.stage` string attribute, that we need to phase out in favor of `ci_stages.name`.
Diffstat (limited to 'spec/models/commit_status_spec.rb')
-rw-r--r--spec/models/commit_status_spec.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/spec/models/commit_status_spec.rb b/spec/models/commit_status_spec.rb
index 1e074c7ad26..c0cbf0b2f95 100644
--- a/spec/models/commit_status_spec.rb
+++ b/spec/models/commit_status_spec.rb
@@ -7,10 +7,10 @@ describe CommitStatus, :models do
create(:ci_pipeline, project: project, sha: project.commit.id)
end
- let(:commit_status) { create_status }
+ let(:commit_status) { create_status(stage: 'test') }
- def create_status(args = {})
- create(:commit_status, args.merge(pipeline: pipeline))
+ def create_status(**opts)
+ create(:commit_status, pipeline: pipeline, **opts)
end
it { is_expected.to belong_to(:pipeline) }
@@ -408,6 +408,18 @@ describe CommitStatus, :models do
end
end
+ describe '#stage_entity' do
+ let!(:stage) do
+ create(:ci_stage_entity, pipeline: commit_status.pipeline,
+ name: commit_status.stage)
+ end
+
+ it 'has a correct association with persisted stage' do
+ expect(commit_status.stage_entity).to eq stage
+ end
+ end
+
+
describe '#locking_enabled?' do
before do
commit_status.lock_version = 100