2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'Auto deploy' do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:project, :repository) }
|
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
create :kubernetes_service, project: project
|
2017-08-17 22:00:37 +05:30
|
|
|
project.team << [user, :master]
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in user
|
2017-08-17 22:00:37 +05:30
|
|
|
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-09-10 17:25:29 +05:30
|
|
|
visit project_path(project)
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_no_content('Set up auto deploy')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when a deployment service is active' do
|
|
|
|
before do
|
|
|
|
project.kubernetes_service.update!(active: true)
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_path(project)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'shows a button to set up auto deploy' do
|
|
|
|
expect(page).to have_link('Set up auto deploy')
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'includes OpenShift as an available template', js: true do
|
|
|
|
click_link 'Set up auto deploy'
|
|
|
|
click_button 'Apply a GitLab CI Yaml template'
|
|
|
|
|
|
|
|
within '.gitlab-ci-yml-selector' do
|
|
|
|
expect(page).to have_content('OpenShift')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'creates a merge request using "auto-deploy" branch', js: true do
|
|
|
|
click_link 'Set up auto deploy'
|
|
|
|
click_button 'Apply a GitLab CI Yaml template'
|
|
|
|
within '.gitlab-ci-yml-selector' do
|
|
|
|
click_on 'OpenShift'
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2017-08-17 22:00:37 +05:30
|
|
|
click_button 'Commit changes'
|
|
|
|
|
|
|
|
expect(page).to have_content('New Merge Request From auto-deploy into master')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|