Skip to content
Snippets Groups Projects
Commit 17faa8a2 authored by Grzegorz Bizon's avatar Grzegorz Bizon
Browse files

Fix specs for environments with manual actions

parent 9b27f49d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -57,7 +57,7 @@ FactoryGirl.define do
end
 
trait :manual do
status 'skipped'
status 'manual'
self.when 'manual'
end
 
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ feature 'Environment', :feature do
feature 'environment details page' do
given!(:environment) { create(:environment, project: project) }
given!(:deployment) { }
given!(:manual) { }
given!(:action) { }
 
before do
visit_environment(environment)
Loading
Loading
@@ -69,17 +69,23 @@ feature 'Environment', :feature do
end
 
context 'with manual action' do
given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'deploy to production') }
given(:action) do
create(:ci_build, :manual, pipeline: pipeline,
name: 'deploy to production')
end
 
scenario 'does show a play button' do
expect(page).to have_link(manual.name.humanize)
expect(page).to have_link(action.name.humanize)
end
 
scenario 'does allow to play manual action' do
expect(manual).to be_skipped
expect{ click_link(manual.name.humanize) }.not_to change { Ci::Pipeline.count }
expect(page).to have_content(manual.name)
expect(manual.reload).to be_pending
expect(action).to be_manual
expect { click_link(action.name.humanize) }
.not_to change { Ci::Pipeline.count }
expect(page).to have_content(action.name)
expect(action.reload).to be_pending
end
 
context 'with external_url' do
Loading
Loading
@@ -130,8 +136,16 @@ feature 'Environment', :feature do
 
context 'when environment is available' do
context 'with stop action' do
given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'close_app') }
given(:deployment) { create(:deployment, environment: environment, deployable: build, on_stop: 'close_app') }
given(:action) do
create(:ci_build, :manual, pipeline: pipeline,
name: 'close_app')
end
given(:deployment) do
create(:deployment, environment: environment,
deployable: build,
on_stop: 'close_app')
end
 
scenario 'does show stop button' do
expect(page).to have_link('Stop')
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@ feature 'Environments page', :feature, :js do
 
given!(:environment) { }
given!(:deployment) { }
given!(:manual) { }
given!(:action) { }
 
before do
visit_environments(project)
Loading
Loading
@@ -90,7 +90,7 @@ feature 'Environments page', :feature, :js do
given(:pipeline) { create(:ci_pipeline, project: project) }
given(:build) { create(:ci_build, pipeline: pipeline) }
 
given(:manual) do
given(:action) do
create(:ci_build, :manual, pipeline: pipeline, name: 'deploy to production')
end
 
Loading
Loading
@@ -102,19 +102,19 @@ feature 'Environments page', :feature, :js do
 
scenario 'does show a play button' do
find('.js-dropdown-play-icon-container').click
expect(page).to have_content(manual.name.humanize)
expect(page).to have_content(action.name.humanize)
end
 
scenario 'does allow to play manual action', js: true do
expect(manual).to be_skipped
expect(action).to be_manual
 
find('.js-dropdown-play-icon-container').click
expect(page).to have_content(manual.name.humanize)
expect(page).to have_content(action.name.humanize)
 
expect { click_link(manual.name.humanize) }
expect { click_link(action.name.humanize) }
.not_to change { Ci::Pipeline.count }
 
expect(manual.reload).to be_pending
expect(action.reload).to be_pending
end
 
scenario 'does show build name and id' do
Loading
Loading
@@ -144,8 +144,15 @@ feature 'Environments page', :feature, :js do
end
 
context 'with stop action' do
given(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'close_app') }
given(:deployment) { create(:deployment, environment: environment, deployable: build, on_stop: 'close_app') }
given(:action) do
create(:ci_build, :manual, pipeline: pipeline, name: 'close_app')
end
given(:deployment) do
create(:deployment, environment: environment,
deployable: build,
on_stop: 'close_app')
end
 
scenario 'does show stop button' do
expect(page).to have_selector('.stop-env-link')
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment