diff --git a/ee/app/components/namespaces/combined_storage_users/base_alert_component.rb b/ee/app/components/namespaces/combined_storage_users/base_alert_component.rb index 6685706bfa90d2b51391c879e17e96c353915df2..801803655f4ba7eb21906e5af3e60397dd408601 100644 --- a/ee/app/components/namespaces/combined_storage_users/base_alert_component.rb +++ b/ee/app/components/namespaces/combined_storage_users/base_alert_component.rb @@ -93,7 +93,7 @@ def free_users_limit end def free_storage_limit - limit = root_namespace.actual_limits.storage_size_limit.megabytes + limit = ::Namespaces::Storage::RootSize.new(root_namespace).dashboard_limit number_to_human_size(limit, precision: 0) end diff --git a/ee/spec/components/namespaces/combined_storage_users/non_owner_alert_component_spec.rb b/ee/spec/components/namespaces/combined_storage_users/non_owner_alert_component_spec.rb index e2dd58d30eb22b59180f03c06312aae409ee2fbe..ab80751835f6d83843053d89ce97355c8b9b308a 100644 --- a/ee/spec/components/namespaces/combined_storage_users/non_owner_alert_component_spec.rb +++ b/ee/spec/components/namespaces/combined_storage_users/non_owner_alert_component_spec.rb @@ -88,6 +88,15 @@ expect(page).to have_content(alert_title) end end + + context 'when the user has purchased additional storage' do + it 'includes the purchased storage in the alert' do + namespace.additional_purchased_storage_size = 10_240 + render_inline(component) + + expect(page).to have_content('15 GiB') + end + end end context 'when not over one of the limits' do diff --git a/ee/spec/components/namespaces/combined_storage_users/owner_alert_component_spec.rb b/ee/spec/components/namespaces/combined_storage_users/owner_alert_component_spec.rb index 17dd6f394632be819e44485bb88b95a82a94ec6a..779e78e1b8908abc712ee64a1fa303e010c4bb98 100644 --- a/ee/spec/components/namespaces/combined_storage_users/owner_alert_component_spec.rb +++ b/ee/spec/components/namespaces/combined_storage_users/owner_alert_component_spec.rb @@ -88,6 +88,15 @@ expect(page).to have_content(alert_title) end end + + context 'when the user has purchased additional storage' do + it 'includes the purchased storage in the alert' do + namespace.additional_purchased_storage_size = 10_240 + render_inline(component) + + expect(page).to have_content('15 GiB') + end + end end context 'when not over one of the limits' do