debian-mirror-gitlab/spec/features/projects/settings/pipelines_settings_spec.rb

81 lines
2.2 KiB
Ruby
Raw Normal View History

2016-08-24 12:49:21 +05:30
require 'spec_helper'
2018-10-15 14:42:47 +05:30
describe "Projects > Settings > Pipelines settings" do
2017-09-10 17:25:29 +05:30
let(:project) { create(:project) }
2016-08-24 12:49:21 +05:30
let(:user) { create(:user) }
let(:role) { :developer }
2018-10-15 14:42:47 +05:30
before do
2017-09-10 17:25:29 +05:30
sign_in(user)
2018-03-17 18:26:18 +05:30
project.add_role(user, role)
2018-10-15 14:42:47 +05:30
create(:project_auto_devops, project: project)
2016-08-24 12:49:21 +05:30
end
context 'for developer' do
2018-10-15 14:42:47 +05:30
let(:role) { :developer }
2016-08-24 12:49:21 +05:30
2018-10-15 14:42:47 +05:30
it 'to be disallowed to view' do
2018-03-17 18:26:18 +05:30
visit project_settings_ci_cd_path(project)
2016-08-24 12:49:21 +05:30
expect(page.status_code).to eq(404)
end
end
context 'for master' do
2018-10-15 14:42:47 +05:30
let(:role) { :master }
2016-08-24 12:49:21 +05:30
2018-10-15 14:42:47 +05:30
it 'be allowed to change' do
2018-03-17 18:26:18 +05:30
visit project_settings_ci_cd_path(project)
2016-08-24 12:49:21 +05:30
fill_in('Test coverage parsing', with: 'coverage_regex')
2018-10-15 14:42:47 +05:30
page.within '#js-general-pipeline-settings' do
click_on 'Save changes'
end
2016-08-24 12:49:21 +05:30
expect(page.status_code).to eq(200)
2018-10-15 14:42:47 +05:30
page.within '#js-general-pipeline-settings' do
expect(page).to have_button('Save changes', disabled: false)
end
2016-08-24 12:49:21 +05:30
expect(page).to have_field('Test coverage parsing', with: 'coverage_regex')
end
2017-08-17 22:00:37 +05:30
2018-10-15 14:42:47 +05:30
it 'updates auto_cancel_pending_pipelines' do
2018-03-17 18:26:18 +05:30
visit project_settings_ci_cd_path(project)
2017-08-17 22:00:37 +05:30
page.check('Auto-cancel redundant, pending pipelines')
2018-10-15 14:42:47 +05:30
page.within '#js-general-pipeline-settings' do
click_on 'Save changes'
end
2017-08-17 22:00:37 +05:30
expect(page.status_code).to eq(200)
2018-10-15 14:42:47 +05:30
page.within '#js-general-pipeline-settings' do
expect(page).to have_button('Save changes', disabled: false)
end
2017-08-17 22:00:37 +05:30
checkbox = find_field('project_auto_cancel_pending_pipelines')
expect(checkbox).to be_checked
end
2018-03-17 18:26:18 +05:30
describe 'Auto DevOps' do
it 'update auto devops settings' do
visit project_settings_ci_cd_path(project)
2018-10-15 14:42:47 +05:30
page.within '#autodevops-settings' do
fill_in('project_auto_devops_attributes_domain', with: 'test.com')
page.choose('project_auto_devops_attributes_enabled_false')
click_on 'Save changes'
end
2018-03-17 18:26:18 +05:30
expect(page.status_code).to eq(200)
expect(project.auto_devops).to be_present
expect(project.auto_devops).not_to be_enabled
2018-10-15 14:42:47 +05:30
expect(project.auto_devops.domain).to eq('test.com')
2018-03-17 18:26:18 +05:30
end
end
2016-08-24 12:49:21 +05:30
end
end