summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2019-04-24 15:44:12 +0200
committerMatija Čupić <matteeyah@gmail.com>2019-04-24 15:44:12 +0200
commit163730f0a2c8f7266cc9521bfd326b351688c48c (patch)
treeb1626706cbdff720cbae2d2344495e2aacfb5b3b
parenta89e8149b686c37962612779b0d245e7a90e59a8 (diff)
downloadgitlab-ce-163730f0a2c8f7266cc9521bfd326b351688c48c.tar.gz
Redirect to settings page on invalid update
-rw-r--r--app/controllers/projects/settings/ci_cd_controller.rb2
-rw-r--r--spec/controllers/projects/settings/ci_cd_controller_spec.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/projects/settings/ci_cd_controller.rb b/app/controllers/projects/settings/ci_cd_controller.rb
index d1c5cef76fa..c4dff95a4b9 100644
--- a/app/controllers/projects/settings/ci_cd_controller.rb
+++ b/app/controllers/projects/settings/ci_cd_controller.rb
@@ -19,7 +19,7 @@ module Projects
redirect_to project_settings_ci_cd_path(@project)
else
- render 'show'
+ redirect_to project_settings_ci_cd_path(@project), alert: result[:message]
end
end
end
diff --git a/spec/controllers/projects/settings/ci_cd_controller_spec.rb b/spec/controllers/projects/settings/ci_cd_controller_spec.rb
index fc9a0adeed2..db53e5bc8a4 100644
--- a/spec/controllers/projects/settings/ci_cd_controller_spec.rb
+++ b/spec/controllers/projects/settings/ci_cd_controller_spec.rb
@@ -191,6 +191,15 @@ describe Projects::Settings::CiCdController do
expect(project.build_timeout).to eq(5400)
end
end
+
+ context 'when build_timeout_human_readable is invalid' do
+ let(:params) { { build_timeout_human_readable: '5m' } }
+
+ it 'set specified timeout' do
+ expect(subject).to set_flash[:alert]
+ expect(response).to redirect_to(namespace_project_settings_ci_cd_path)
+ end
+ end
end
end
end