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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 09:09:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-12 09:09:05 +0300
commit8c9dc985b90c353b33cb829caf51f8320171bc15 (patch)
tree9a68886dbea1aefabddb46bbd3faf961eab22ae6 /spec/models/ci
parent500626a5c953ad81cfc3ed74bf0148c075617e58 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/ci')
-rw-r--r--spec/models/ci/build_spec.rb3
-rw-r--r--spec/models/ci/processable_spec.rb68
2 files changed, 70 insertions, 1 deletions
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index b99f51bb36e..91185446488 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -3007,7 +3007,8 @@ describe Ci::Build do
stage: 'test',
ref: 'feature',
project: project,
- pipeline: pipeline
+ pipeline: pipeline,
+ scheduling_type: :stage
)
end
diff --git a/spec/models/ci/processable_spec.rb b/spec/models/ci/processable_spec.rb
index 87dbcbf870e..370606a73bc 100644
--- a/spec/models/ci/processable_spec.rb
+++ b/spec/models/ci/processable_spec.rb
@@ -52,4 +52,72 @@ describe Ci::Processable do
end
end
end
+
+ describe 'validate presence of scheduling_type' do
+ context 'on create' do
+ let(:processable) do
+ build(
+ :ci_build, :created, project: project, pipeline: pipeline,
+ importing: importing, scheduling_type: nil
+ )
+ end
+
+ context 'when importing' do
+ let(:importing) { true }
+
+ context 'when validate_scheduling_type_of_processables is true' do
+ before do
+ stub_feature_flags(validate_scheduling_type_of_processables: true)
+ end
+
+ it 'does not validate' do
+ expect(processable).to be_valid
+ end
+ end
+
+ context 'when validate_scheduling_type_of_processables is false' do
+ before do
+ stub_feature_flags(validate_scheduling_type_of_processables: false)
+ end
+
+ it 'does not validate' do
+ expect(processable).to be_valid
+ end
+ end
+ end
+
+ context 'when not importing' do
+ let(:importing) { false }
+
+ context 'when validate_scheduling_type_of_processables is true' do
+ before do
+ stub_feature_flags(validate_scheduling_type_of_processables: true)
+ end
+
+ it 'validates' do
+ expect(processable).not_to be_valid
+ end
+ end
+
+ context 'when validate_scheduling_type_of_processables is false' do
+ before do
+ stub_feature_flags(validate_scheduling_type_of_processables: false)
+ end
+
+ it 'does not validate' do
+ expect(processable).to be_valid
+ end
+ end
+ end
+ end
+
+ context 'on update' do
+ let(:processable) { create(:ci_build, :created, project: project, pipeline: pipeline) }
+
+ it 'does not validate' do
+ processable.scheduling_type = nil
+ expect(processable).to be_valid
+ end
+ end
+ end
end