Commit fd333b8d authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve tests for security report page

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 3a6ef0ed
......@@ -17,6 +17,7 @@ describe Projects::PipelinesController do
before do
create(
:ci_build,
:success,
:artifacts,
name: 'sast',
pipeline: pipeline,
......@@ -26,24 +27,56 @@ describe Projects::PipelinesController do
}
}
)
end
context 'with feature enabled' do
before do
allow(License).to receive(:feature_available?).and_return(true)
get :security, namespace_id: project.namespace, project_id: project, id: pipeline
get :security, namespace_id: project.namespace, project_id: project, id: pipeline
end
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template :show
end
end
it do
expect(response).to have_gitlab_http_status(200)
expect(response).to render_template :show
context 'with feature disabled' do
before do
get :security, namespace_id: project.namespace, project_id: project, id: pipeline
end
it do
expect(response).to have_gitlab_http_status(:redirect)
expect(response).to redirect_to(pipeline_path(pipeline))
end
end
end
context 'without sast artifact' do
before do
get :security, namespace_id: project.namespace, project_id: project, id: pipeline
context 'with feature enabled' do
before do
allow(License).to receive(:feature_available?).and_return(true)
get :security, namespace_id: project.namespace, project_id: project, id: pipeline
end
it do
expect(response).to have_gitlab_http_status(:redirect)
expect(response).to redirect_to(pipeline_path(pipeline))
end
end
it do
expect(response).to have_gitlab_http_status(:redirect)
expect(response).to redirect_to(pipeline_path(pipeline))
context 'with feature disabled' do
before do
get :security, namespace_id: project.namespace, project_id: project, id: pipeline
end
it do
expect(response).to have_gitlab_http_status(:redirect)
expect(response).to redirect_to(pipeline_path(pipeline))
end
end
end
end
......
......@@ -7,6 +7,8 @@ describe 'Pipeline', :js do
before do
sign_in(user)
project.add_developer(user)
allow(License).to receive(:feature_available?).and_return(true)
end
describe 'GET /:project/pipelines/:id/security' do
......@@ -16,6 +18,7 @@ describe 'Pipeline', :js do
before do
create(
:ci_build,
:success,
:artifacts,
name: 'sast',
pipeline: pipeline,
......
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