Redirect to settings page on invalid update

This commit is contained in:
Matija Čupić 2019-04-24 15:44:12 +02:00
parent a89e8149b6
commit 163730f0a2
No known key found for this signature in database
GPG Key ID: 4BAF84FFACD2E5DE
2 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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