Fix stage and pipeline specs and rubocop offenses
This commit is contained in:
parent
ec4b1bc755
commit
2b486c2bb2
|
@ -12,14 +12,6 @@ describe Projects::PipelinesController do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'GET stages.json' do
|
describe 'GET stages.json' do
|
||||||
def get_stage(name)
|
|
||||||
get :stage, namespace_id: project.namespace.path,
|
|
||||||
project_id: project.path,
|
|
||||||
id: pipeline.id,
|
|
||||||
stage: name,
|
|
||||||
format: :json
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when accessing existing stage' do
|
context 'when accessing existing stage' do
|
||||||
before do
|
before do
|
||||||
create(:ci_build, pipeline: pipeline, stage: 'build')
|
create(:ci_build, pipeline: pipeline, stage: 'build')
|
||||||
|
@ -39,8 +31,17 @@ describe Projects::PipelinesController do
|
||||||
get_stage('test')
|
get_stage('test')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(response).to have_http_status(:not_found) }
|
it 'responds with not found' do
|
||||||
|
expect(response).to have_http_status(:not_found)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_stage(name)
|
||||||
|
get :stage, namespace_id: project.namespace.path,
|
||||||
|
project_id: project.path,
|
||||||
|
id: pipeline.id,
|
||||||
|
stage: name,
|
||||||
|
format: :json
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe "Pipelines", feature: true, js:true do
|
describe 'Pipelines', :feature, :js do
|
||||||
include GitlabRoutingHelper
|
include GitlabRoutingHelper
|
||||||
include WaitForAjax
|
include WaitForAjax
|
||||||
|
|
||||||
|
@ -70,23 +70,32 @@ describe "Pipelines", feature: true, js:true do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with manual actions' do
|
context 'with manual actions' do
|
||||||
let!(:manual) { create(:ci_build, :manual, pipeline: pipeline, name: 'manual build', stage: 'test', commands: 'test') }
|
let!(:manual) do
|
||||||
|
create(:ci_build, :manual, pipeline: pipeline,
|
||||||
|
name: 'manual build',
|
||||||
|
stage: 'test',
|
||||||
|
commands: 'test')
|
||||||
|
end
|
||||||
|
|
||||||
before { visit namespace_project_pipelines_path(project.namespace, project) }
|
before do
|
||||||
|
visit namespace_project_pipelines_path(project.namespace, project)
|
||||||
|
end
|
||||||
|
|
||||||
it do
|
it 'has link to the manual action' do
|
||||||
find('.js-pipeline-dropdown-manual-actions').click
|
find('.js-pipeline-dropdown-manual-actions').click
|
||||||
|
|
||||||
expect(page).to have_link('Manual build')
|
expect(page).to have_link('Manual build')
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when playing' do
|
context 'when manual action was played' do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
find('.js-pipeline-dropdown-manual-actions').click
|
find('.js-pipeline-dropdown-manual-actions').click
|
||||||
click_link('Manual build')
|
click_link('Manual build')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(manual.reload).to be_pending }
|
it 'enqueues manual action job' do
|
||||||
|
expect(manual.reload).to be_pending
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -183,9 +183,9 @@ describe Ci::Pipeline, models: true do
|
||||||
create(:commit_status, pipeline: pipeline, stage: 'test')
|
create(:commit_status, pipeline: pipeline, stage: 'test')
|
||||||
end
|
end
|
||||||
|
|
||||||
it { expect(subject).to be_a(Ci::Stage) }
|
it { expect(subject).to be_a Ci::Stage }
|
||||||
it { expect(subject.name).to eq('stage') }
|
it { expect(subject.name).to eq 'test' }
|
||||||
it { expect(subject.statues).not_to be_empty }
|
it { expect(subject.statuses).not_to be_empty }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'without status in stage' do
|
context 'without status in stage' do
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe Ci::Stage, models: true do
|
||||||
|
|
||||||
describe '#statuses_count' do
|
describe '#statuses_count' do
|
||||||
before do
|
before do
|
||||||
create_job(:ci_build) }
|
create_job(:ci_build)
|
||||||
create_job(:ci_build, stage: 'other stage')
|
create_job(:ci_build, stage: 'other stage')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue