2016-12-21 15:21:55 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'Auto deploy' do
|
|
|
|
let(:user) { create(:user) }
|
2017-03-28 21:13:16 +00:00
|
|
|
let(:project) { create(:project, :repository) }
|
2016-12-21 15:21:55 +00:00
|
|
|
|
|
|
|
before do
|
2017-05-15 09:50:55 +00:00
|
|
|
create :kubernetes_service, project: project
|
2016-12-21 15:21:55 +00: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 10:08:09 +00:00
|
|
|
expect(page).to have_no_content('Set up auto deploy')
|
2016-12-21 15:21:55 +00: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 10:08:09 +00:00
|
|
|
expect(page).to have_link('Set up auto deploy')
|
2016-12-21 15:21:55 +00:00
|
|
|
end
|
|
|
|
|
2016-12-23 10:08:09 +00:00
|
|
|
it 'includes OpenShift as an available template', js: true do
|
|
|
|
click_link 'Set up auto deploy'
|
2017-04-03 17:54:40 +00:00
|
|
|
click_button 'Apply a GitLab CI Yaml template'
|
2016-12-21 15:21:55 +00:00
|
|
|
|
|
|
|
within '.gitlab-ci-yml-selector' do
|
2016-12-21 20:13:13 +00:00
|
|
|
expect(page).to have_content('OpenShift')
|
2016-12-21 15:21:55 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-12-23 10:08:09 +00:00
|
|
|
it 'creates a merge request using "auto-deploy" branch', js: true do
|
|
|
|
click_link 'Set up auto deploy'
|
2017-04-03 17:54:40 +00:00
|
|
|
click_button 'Apply a GitLab CI Yaml template'
|
2016-12-21 15:21:55 +00:00
|
|
|
within '.gitlab-ci-yml-selector' do
|
2016-12-21 20:13:13 +00:00
|
|
|
click_on 'OpenShift'
|
2016-12-21 15:21:55 +00:00
|
|
|
end
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-04-04 18:06:32 +00:00
|
|
|
click_button 'Commit changes'
|
2016-12-21 15:21:55 +00:00
|
|
|
|
2016-12-23 10:08:09 +00:00
|
|
|
expect(page).to have_content('New Merge Request From auto-deploy into master')
|
2016-12-21 15:21:55 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|