Commit d01ebcc7 authored by Fabio Pitino's avatar Fabio Pitino

Improve readability of specs table for credit card requirement

Make table more compact for better readability
parent 876749b5
......@@ -1683,31 +1683,29 @@ RSpec.describe User do
using RSpec::Parameterized::TableSyntax
where(:saas, :cc_present, :shared_runners, :is_free, :is_trial, :free_ff_enabled, :trial_ff_enabled, :old_users_ff_enabled, :days_from_release, :result, :description) do
where(:saas, :cc_present, :shared_runners, :plan, :feature_flags, :days_from_release, :result, :description) do
# self-hosted
nil | false | :enabled | false | false | true | true | false | 0 | true | 'self-hosted paid plan'
nil | false | :enabled | false | true | true | true | false | 0 | true | 'self-hosted missing CC on trial plan'
nil | false | :enabled | :paid | %i[free trial] | 0 | true | 'self-hosted paid plan'
nil | false | :enabled | :trial | %i[free trial] | 0 | true | 'self-hosted missing CC on trial plan'
# saas
:saas | false | :enabled | false | false | true | true | false | 0 | true | 'missing CC on paid plan'
# free plan
:saas | false | :enabled | true | false | true | true | false | 0 | false | 'missing CC on free plan'
:saas | false | nil | true | false | true | true | false | 0 | true | 'missing CC on free plan and shared runners disabled'
:saas | false | :enabled | true | false | true | true | false | -1 | true | 'missing CC on free plan but old user'
:saas | false | :enabled | true | false | true | true | true | -1 | false | 'missing CC on free plan but old user and FF enabled'
:saas | false | nil | true | false | true | true | true | -1 | true | 'missing CC on free plan but old user and FF enabled and shared runners disabled'
:saas | true | :enabled | true | false | true | true | false | 0 | true | 'present CC on free plan'
:saas | false | :enabled | true | false | false | true | false | 0 | true | 'missing CC on free plan - FF off'
# trial plan
:saas | false | :enabled | false | true | true | true | false | 0 | false | 'missing CC on trial plan'
:saas | false | nil | false | true | true | true | false | 0 | true | 'missing CC on trial plan and shared runners disabled'
:saas | false | :enabled | false | true | true | true | false | -1 | true | 'missing CC on trial plan but old user'
:saas | false | :enabled | false | true | true | true | true | -1 | false | 'missing CC on trial plan but old user and FF enabled'
:saas | false | nil | false | true | true | true | true | -1 | true | 'missing CC on trial plan but old user and FF enabled and shared runners disabled'
:saas | false | :enabled | false | true | true | false | false | 0 | true | 'missing CC on trial plan - FF off'
:saas | true | :enabled | false | true | true | true | false | 0 | true | 'present CC on trial plan'
:saas | false | :enabled | :paid | %i[free trial old_users] | 0 | true | 'missing CC on paid plan'
:saas | false | :enabled | :free | %i[free trial] | 0 | false | 'missing CC on free plan'
:saas | false | nil | :free | %i[free trial] | 0 | true | 'missing CC on free plan and shared runners disabled'
:saas | false | :enabled | :free | %i[free trial] | -1 | true | 'missing CC on free plan but old user'
:saas | false | :enabled | :free | %i[free trial old_users] | -1 | false | 'missing CC on free plan but old user and FF enabled'
:saas | false | nil | :free | %i[free trial old_users] | -1 | true | 'missing CC on free plan but old user and FF enabled and shared runners disabled'
:saas | true | :enabled | :free | %i[free trial] | 0 | true | 'present CC on free plan'
:saas | false | :enabled | :free | %i[] | 0 | true | 'missing CC on free plan - FF off'
:saas | false | :enabled | :trial | %i[free trial] | 0 | false | 'missing CC on trial plan'
:saas | false | nil | :trial | %i[free trial] | 0 | true | 'missing CC on trial plan and shared runners disabled'
:saas | false | :enabled | :trial | %i[free trial] | -1 | true | 'missing CC on trial plan but old user'
:saas | false | :enabled | :trial | %i[free trial old_users] | -1 | false | 'missing CC on trial plan but old user and FF enabled'
:saas | false | nil | :trial | %i[free trial old_users] | -1 | true | 'missing CC on trial plan but old user and FF enabled and shared runners disabled'
:saas | false | :enabled | :trial | %i[] | 0 | true | 'missing CC on trial plan - FF off'
:saas | true | :enabled | :trial | %i[free trial] | 0 | true | 'present CC on trial plan'
end
let(:shared_runners_enabled) { shared_runners == :enabled }
......@@ -1717,13 +1715,13 @@ RSpec.describe User do
allow(::Gitlab).to receive(:com?).and_return(saas == :saas)
user.created_at = ::Users::CreditCardValidation::RELEASE_DAY + days_from_release.days
allow(user).to receive(:credit_card_validated_at).and_return(Time.current) if cc_present
allow(project.namespace).to receive(:free_plan?).and_return(is_free)
allow(project.namespace).to receive(:trial?).and_return(is_trial)
allow(project.namespace).to receive(:free_plan?).and_return(plan == :free)
allow(project.namespace).to receive(:trial?).and_return(plan == :trial)
project.update!(shared_runners_enabled: shared_runners_enabled)
stub_feature_flags(
ci_require_credit_card_on_free_plan: free_ff_enabled,
ci_require_credit_card_on_trial_plan: trial_ff_enabled,
ci_require_credit_card_for_old_users: old_users_ff_enabled)
ci_require_credit_card_on_free_plan: feature_flags.include?(:free),
ci_require_credit_card_on_trial_plan: feature_flags.include?(:trial),
ci_require_credit_card_for_old_users: feature_flags.include?(:old_users))
end
it description 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