summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2018-04-04 21:32:32 +0200
committerTomasz Maczukin <tomasz@maczukin.pl>2018-04-04 21:32:32 +0200
commit5197b1439c1b1352695cebc4bcc8a09f9c0ed589 (patch)
treee6b5f9f06214abda699e56330006f91f4d89b0d3 /spec/controllers
parenta52e3edd1a1869c2656193c95f8f2e8fd3bc8fa2 (diff)
downloadgitlab-ce-5197b1439c1b1352695cebc4bcc8a09f9c0ed589.tar.gz
Update tests for settings/ci_cd_controller_spec
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/projects/settings/ci_cd_controller_spec.rb46
1 files changed, 35 insertions, 11 deletions
diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb
index 330bd760040..7dae9b85d78 100644
--- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb
+++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb
@@ -58,27 +58,27 @@ describe Projects::Settings::CiCdController do
end
describe 'PATCH update' do
+ let(:params) { { ci_config_path: '' } }
+
subject do
patch :update,
namespace_id: project.namespace.to_param,
project_id: project,
- project: {
- auto_devops_attributes: params
- }
+ project: params
end
- context 'when updating the auto_devops settings' do
- let(:params) { { enabled: '', domain: 'mepmep.md' } }
+ it 'redirects to the settings page' do
+ subject
- it 'redirects to the settings page' do
- subject
+ expect(response).to have_gitlab_http_status(302)
+ expect(flash[:notice]).to eq("Pipelines settings for '#{project.name}' were successfully updated.")
+ end
- expect(response).to have_gitlab_http_status(302)
- expect(flash[:notice]).to eq("Pipelines settings for '#{project.name}' were successfully updated.")
- end
+ context 'when updating the auto_devops settings' do
+ let(:params) { { auto_devops_attributes: { enabled: '', domain: 'mepmep.md' } } }
context 'following the instance default' do
- let(:params) { { enabled: '' } }
+ let(:params) { { auto_devops_attributes: { enabled: '' } } }
it 'allows enabled to be set to nil' do
subject
@@ -134,5 +134,29 @@ describe Projects::Settings::CiCdController do
end
end
end
+
+ context 'when updating general settings' do
+ context 'when build_timeout_human_readable is not specified' do
+ let(:params) { { build_timeout_human_readable: '' } }
+
+ it 'set default timeout' do
+ subject
+
+ project.reload
+ expect(project.build_timeout).to eq(3600)
+ end
+ end
+
+ context 'when build_timeout_human_readable is specified' do
+ let(:params) { { build_timeout_human_readable: '1h 30m' } }
+
+ it 'set specified timeout' do
+ subject
+
+ project.reload
+ expect(project.build_timeout).to eq(5400)
+ end
+ end
+ end
end
end