Commit fd7fbb27 authored by Ragnar Hardarson's avatar Ragnar Hardarson Committed by Vitaly Slobodin

Use purchase helper for automatic storage

parent abd6f3ec
- page_title s_("UsageQuota|Usage")
- url_to_purchase_storage = purchase_storage_url if can_purchase_storage?
- url_to_purchase_storage = purchase_storage_url if can_purchase_storage_for_namespace?(@group)
%h3.page-title
= s_('UsageQuota|Usage Quotas')
......
- page_title s_("UsageQuota|Usage")
- @content_class = "limit-container-width" unless fluid_layout
- url_to_purchase_storage = purchase_storage_url if can_purchase_storage?
- url_to_purchase_storage = purchase_storage_url if can_purchase_storage_for_namespace?(@namespace)
%h3.page-title
= s_('UsageQuota|Usage Quotas')
......
......@@ -8,7 +8,7 @@ RSpec.describe ProjectsController do
let(:project) { create(:project) }
let_it_be(:public_project) { create(:project, :public, :repository) }
let_it_be(:public_project) { create(:project, :public, :repository, namespace: group) }
before do
project.add_maintainer(user)
......@@ -20,6 +20,37 @@ RSpec.describe ProjectsController do
subject { get :show, params: { namespace_id: public_project.namespace.path, id: public_project.path } }
context 'additional repo storage by namespace' do
using RSpec::Parameterized::TableSyntax
let(:namespace) { public_project.namespace }
where(:automatic_purchased_storage_allocation, :additional_repo_storage_by_namespace, :expected_to_render) do
true | true | true
true | false | false
false | true | false
false | false | false
end
with_them do
before do
allow_next_instance_of(EE::Namespace::RootExcessStorageSize) do |root_storage|
allow(root_storage).to receive(:usage_ratio).and_return(0.5)
allow(root_storage).to receive(:above_size_limit?).and_return(true)
end
stub_application_setting(automatic_purchased_storage_allocation: automatic_purchased_storage_allocation)
stub_feature_flags(additional_repo_storage_by_namespace: additional_repo_storage_by_namespace, namespace_storage_limit: false)
namespace.add_owner(user)
end
it do
subject
expect(response.body.include?("Please purchase additional storage")).to eq(expected_to_render)
end
end
end
context 'with additional_repo_storage_by_namespace_enabled? enabled' do
before do
allow_any_instance_of(EE::Namespace).to receive(:additional_repo_storage_by_namespace_enabled?).and_return(true)
......
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