Extract anonymous user context in pipelines specs
This commit is contained in:
parent
6a7a31b82a
commit
e83ae21d98
1 changed files with 255 additions and 244 deletions
|
@ -7,6 +7,8 @@ describe 'Pipelines', :feature, :js do
|
|||
include WaitForAjax
|
||||
|
||||
let(:project) { create(:empty_project) }
|
||||
|
||||
context 'when user is logged in' do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
before do
|
||||
|
@ -39,17 +41,6 @@ describe 'Pipelines', :feature, :js do
|
|||
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
|
||||
let!(:build) do
|
||||
create(:ci_build, pipeline: pipeline,
|
||||
|
@ -316,6 +307,26 @@ describe 'Pipelines', :feature, :js do
|
|||
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)
|
||||
visit namespace_project_pipelines_path(project.namespace, project, query)
|
||||
|
|
Loading…
Reference in a new issue