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]
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in user
|
2016-12-21 10:21:55 -05:00
|
|
|
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
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_path(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)
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_path(project)
|
2016-12-21 10:21:55 -05:00
|
|
|
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
|
2017-05-17 14:25:13 -04:00
|
|
|
wait_for_requests
|
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
|