2016-12-21 10:21:55 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'Auto deploy' do
|
|
|
|
let(:user) { create(:user) }
|
2017-03-28 17:13:16 -04:00
|
|
|
let(:project) { create(:project, :repository) }
|
2016-12-21 10:21:55 -05:00
|
|
|
|
|
|
|
before do
|
2017-05-15 05:50:55 -04:00
|
|
|
create :kubernetes_service, project: project
|
2016-12-21 10:21:55 -05:00
|
|
|
project.team << [user, :master]
|
|
|
|
login_as user
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when no deployment service is active' do
|
|
|
|
before do
|
|
|
|
project.kubernetes_service.update!(active: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not show a button to set up auto deploy' do
|
|
|
|
visit namespace_project_path(project.namespace, project)
|
2016-12-23 05:08:09 -05:00
|
|
|
expect(page).to have_no_content('Set up auto deploy')
|
2016-12-21 10:21:55 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when a deployment service is active' do
|
|
|
|
before do
|
|
|
|
project.kubernetes_service.update!(active: true)
|
|
|
|
visit namespace_project_path(project.namespace, project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows a button to set up auto deploy' do
|
2016-12-23 05:08:09 -05:00
|
|
|
expect(page).to have_link('Set up auto deploy')
|
2016-12-21 10:21:55 -05:00
|
|
|
end
|
|
|
|
|
2016-12-23 05:08:09 -05:00
|
|
|
it 'includes OpenShift as an available template', js: true do
|
|
|
|
click_link 'Set up auto deploy'
|
2017-04-03 13:54:40 -04:00
|
|
|
click_button 'Apply a GitLab CI Yaml template'
|
2016-12-21 10:21:55 -05:00
|
|
|
|
|
|
|
within '.gitlab-ci-yml-selector' do
|
2016-12-21 15:13:13 -05:00
|
|
|
expect(page).to have_content('OpenShift')
|
2016-12-21 10:21:55 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-12-23 05:08:09 -05:00
|
|
|
it 'creates a merge request using "auto-deploy" branch', js: true do
|
|
|
|
click_link 'Set up auto deploy'
|
2017-04-03 13:54:40 -04:00
|
|
|
click_button 'Apply a GitLab CI Yaml template'
|
2016-12-21 10:21:55 -05:00
|
|
|
within '.gitlab-ci-yml-selector' do
|
2016-12-21 15:13:13 -05:00
|
|
|
click_on 'OpenShift'
|
2016-12-21 10:21:55 -05:00
|
|
|
end
|
|
|
|
wait_for_ajax
|
2017-04-04 14:06:32 -04:00
|
|
|
click_button 'Commit changes'
|
2016-12-21 10:21:55 -05:00
|
|
|
|
2016-12-23 05:08:09 -05:00
|
|
|
expect(page).to have_content('New Merge Request From auto-deploy into master')
|
2016-12-21 10:21:55 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|