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
path: root/spec
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-03-23 14:13:21 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2018-03-23 14:13:21 +0300
commitf87ad66cee1fcce347c3072ac27613f65626646e (patch)
tree34b48ba215ff07578bce4b7a192494e1e510a091 /spec
parentbb9d360c0a7daed6aa08a0635e084c314c2c8b3e (diff)
parent92d51da23dfa3e83fb87fd381553a1fd93d49614 (diff)
Merge branch '43482-enabling-auto-devops-on-an-empty-project-gives-you-wrong-information' into 'master'
Resolve "Enabling Auto DevOps on an empty project gives you wrong information" Closes #43482 See merge request gitlab-org/gitlab-ce!17605
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/projects/pipelines_settings_controller_spec.rb28
1 files changed, 25 insertions, 3 deletions
diff --git a/spec/controllers/projects/pipelines_settings_controller_spec.rb b/spec/controllers/projects/pipelines_settings_controller_spec.rb
index 1cc488bef32..913b9bd804a 100644
--- a/spec/controllers/projects/pipelines_settings_controller_spec.rb
+++ b/spec/controllers/projects/pipelines_settings_controller_spec.rb
@@ -47,10 +47,32 @@ describe Projects::PipelinesSettingsController do
expect_any_instance_of(Projects::UpdateService).to receive(:run_auto_devops_pipeline?).and_return(true)
end
- it 'queues a CreatePipelineWorker' do
- expect(CreatePipelineWorker).to receive(:perform_async).with(project.id, user.id, project.default_branch, :web, any_args)
+ context 'when the project repository is empty' do
+ it 'sets a warning flash' do
+ expect(subject).to set_flash[:warning]
+ end
- subject
+ it 'does not queue a CreatePipelineWorker' do
+ expect(CreatePipelineWorker).not_to receive(:perform_async).with(project.id, user.id, project.default_branch, :web, any_args)
+
+ subject
+ end
+ end
+
+ context 'when the project repository is not empty' do
+ let(:project) { create(:project, :repository) }
+
+ it 'sets a success flash' do
+ allow(CreatePipelineWorker).to receive(:perform_async).with(project.id, user.id, project.default_branch, :web, any_args)
+
+ expect(subject).to set_flash[:success]
+ end
+
+ it 'queues a CreatePipelineWorker' do
+ expect(CreatePipelineWorker).to receive(:perform_async).with(project.id, user.id, project.default_branch, :web, any_args)
+
+ subject
+ end
end
end