Commit 66bca235 authored by Filipa Lacerda's avatar Filipa Lacerda

Adds missing tests for all status accepted in scope

parent 05c66406
...@@ -12,7 +12,10 @@ describe Projects::PipelinesController do ...@@ -12,7 +12,10 @@ describe Projects::PipelinesController do
describe 'GET index.json' do describe 'GET index.json' do
before do before do
create_list(:ci_empty_pipeline, 2, project: project) create(:ci_empty_pipeline, status: 'pending', project: project)
create(:ci_empty_pipeline, status: 'running', project: project)
create(:ci_empty_pipeline, status: 'created', project: project)
create(:ci_empty_pipeline, status: 'success', project: project)
get :index, namespace_id: project.namespace.path, get :index, namespace_id: project.namespace.path,
project_id: project.path, project_id: project.path,
...@@ -23,11 +26,11 @@ describe Projects::PipelinesController do ...@@ -23,11 +26,11 @@ describe Projects::PipelinesController do
expect(response).to have_http_status(:ok) expect(response).to have_http_status(:ok)
expect(json_response).to include('pipelines') expect(json_response).to include('pipelines')
expect(json_response['pipelines'].count).to eq 2 expect(json_response['pipelines'].count).to eq 4
expect(json_response['count']['all']).to eq 2 expect(json_response['count']['all']).to eq 4
expect(json_response['count']['running']).to eq 0 expect(json_response['count']['running']).to eq 1
expect(json_response['count']['pending']).to eq 2 expect(json_response['count']['pending']).to eq 1
expect(json_response['count']['finished']).to eq 0 expect(json_response['count']['finished']).to eq 1
end end
end end
......
...@@ -26,7 +26,15 @@ describe 'Pipelines', :feature, :js do ...@@ -26,7 +26,15 @@ describe 'Pipelines', :feature, :js do
) )
end end
[:all, :running, :branches].each do |scope| context 'scope' do
before do
create(:ci_empty_pipeline, status: 'pending', project: project, sha: project.commit.id, ref: 'master')
create(:ci_empty_pipeline, status: 'running', project: project, sha: project.commit.id, ref: 'master')
create(:ci_empty_pipeline, status: 'created', project: project, sha: project.commit.id, ref: 'master')
create(:ci_empty_pipeline, status: 'success', project: project, sha: project.commit.id, ref: 'master')
end
[:all, :running, :pending, :finished, :branches].each do |scope|
context "when displaying #{scope}" do context "when displaying #{scope}" do
before do before do
visit_project_pipelines(scope: scope) visit_project_pipelines(scope: scope)
...@@ -41,6 +49,7 @@ describe 'Pipelines', :feature, :js do ...@@ -41,6 +49,7 @@ describe 'Pipelines', :feature, :js do
end end
end end
end end
end
context 'header tabs' do context 'header tabs' do
before do before do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment