Commit 9c73ee32 authored by Ryan Cobb's avatar Ryan Cobb

Add specs for deployments metrics_dashboard_access_level

parent 61712437
......@@ -36,6 +36,52 @@ RSpec.describe Projects::DeploymentsController do
expect(response).to be_ok
expect(response).to match_response_schema('deployments')
end
context 'anonymous user' do
let(:anonymous_user) { create(:user) }
before do
sign_in(anonymous_user)
end
context 'project and metrics dashboard are public' do
before do
project.update!(
visibility_level: Gitlab::VisibilityLevel::PUBLIC,
project_feature_attributes: {
metrics_dashboard_access_level: Gitlab::VisibilityLevel::PUBLIC
}
)
end
it 'returns a list with deployments information' do
create(:deployment, :success, environment: environment)
get :index, params: deployment_params
expect(response).to be_ok
end
end
context 'project and metrics dashboard are private' do
before do
project.update!(
visibility_level: Gitlab::VisibilityLevel::PRIVATE,
project_feature_attributes: {
metrics_dashboard_access_level: Gitlab::VisibilityLevel::PRIVATE
}
)
end
it 'responds with not found' do
create(:deployment, :success, environment: environment)
get :index, params: deployment_params
expect(response).to be_not_found
end
end
end
end
describe 'GET #metrics' 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