2021-08-23 11:10:43 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Project Usage Quotas' do
|
|
|
|
let_it_be(:project) { create(:project) }
|
|
|
|
let_it_be(:role) { :maintainer }
|
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_role(user, role)
|
|
|
|
login_as(user)
|
|
|
|
end
|
|
|
|
|
|
|
|
shared_examples 'response with 404 status' do
|
|
|
|
it 'renders :not_found' do
|
|
|
|
get project_usage_quotas_path(project)
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(:not_found)
|
|
|
|
expect(response.body).not_to include(project_usage_quotas_path(project))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'GET /:namespace/:project/usage_quotas' do
|
2021-10-19 05:09:54 -04:00
|
|
|
it 'renders usage quotas path' do
|
|
|
|
get project_usage_quotas_path(project)
|
|
|
|
|
|
|
|
expect(response).to have_gitlab_http_status(:ok)
|
|
|
|
expect(response.body).to include(project_usage_quotas_path(project))
|
|
|
|
expect(response.body).to include("Usage of project resources across the <strong>#{project.name}</strong> project")
|
2021-08-23 11:10:43 -04:00
|
|
|
end
|
|
|
|
|
2021-10-19 05:09:54 -04:00
|
|
|
context 'renders :not_found for user without permission' do
|
|
|
|
let(:role) { :developer }
|
2021-08-23 11:10:43 -04:00
|
|
|
|
|
|
|
it_behaves_like 'response with 404 status'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|