Commit e83ae21d authored by Grzegorz Bizon's avatar Grzegorz Bizon

Extract anonymous user context in pipelines specs

parent 6a7a31b8
...@@ -7,6 +7,8 @@ describe 'Pipelines', :feature, :js do ...@@ -7,6 +7,8 @@ describe 'Pipelines', :feature, :js do
include WaitForAjax include WaitForAjax
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
context 'when user is logged in' do
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
...@@ -39,17 +41,6 @@ describe 'Pipelines', :feature, :js do ...@@ -39,17 +41,6 @@ describe 'Pipelines', :feature, :js do
end end
end end
context 'anonymous access' do
let(:project) { create(:project, :public) }
before do
logout
visit_project_pipelines
end
it { expect(page).to have_http_status(:success) }
end
context 'when pipeline is cancelable' do context 'when pipeline is cancelable' do
let!(:build) do let!(:build) do
create(:ci_build, pipeline: pipeline, create(:ci_build, pipeline: pipeline,
...@@ -316,6 +307,26 @@ describe 'Pipelines', :feature, :js do ...@@ -316,6 +307,26 @@ describe 'Pipelines', :feature, :js do
end end
end end
end end
end
context 'when user is not logged in' do
before do
visit namespace_project_pipelines_path(project.namespace, project)
end
context 'when project is public' do
let(:project) { create(:project, :public) }
it { expect(page).to have_content 'No pipelines to show' }
it { expect(page).to have_http_status(:success) }
end
context 'when project is private' do
let(:project) { create(:project, :private) }
it { expect(page).to have_content 'You need to sign in' }
end
end
def visit_project_pipelines(**query) def visit_project_pipelines(**query)
visit namespace_project_pipelines_path(project.namespace, project, query) visit namespace_project_pipelines_path(project.namespace, project, query)
......
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