Commit 9078563a authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch 'use-automatic-purchased-storage-allocation-for-purchase' into 'master'

Use purchase helper for automatic storage

See merge request gitlab-org/gitlab!46582
parents 447d5366 fd7fbb27
- 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