Commit 5197b143 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Update tests for settings/ci_cd_controller_spec

parent a52e3edd
......@@ -58,18 +58,15 @@ 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
......@@ -77,8 +74,11 @@ describe Projects::Settings::CiCdController do
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment