Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d01ebcc7
Commit
d01ebcc7
authored
May 14, 2021
by
Fabio Pitino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve readability of specs table for credit card requirement
Make table more compact for better readability
parent
876749b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
27 deletions
+25
-27
ee/spec/models/ee/user_spec.rb
ee/spec/models/ee/user_spec.rb
+25
-27
No files found.
ee/spec/models/ee/user_spec.rb
View file @
d01ebcc7
...
...
@@ -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:
f
ree_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:
f
eature_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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment