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
5264399c
Commit
5264399c
authored
Mar 02, 2021
by
Dallas Reedy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cover all 4 possible combos of eligible_for_trial_status_widget? values
parent
eb55f93a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
21 deletions
+10
-21
ee/spec/helpers/trial_status_widget_helper_spec.rb
ee/spec/helpers/trial_status_widget_helper_spec.rb
+10
-21
No files found.
ee/spec/helpers/trial_status_widget_helper_spec.rb
View file @
5264399c
...
...
@@ -3,6 +3,8 @@
require
'spec_helper'
RSpec
.
describe
TrialStatusWidgetHelper
do
using
RSpec
::
Parameterized
::
TableSyntax
describe
'#billing_plans_and_trials_available?'
do
before
do
stub_application_setting
(
check_namespace_plan:
trials_available
)
...
...
@@ -24,7 +26,7 @@ RSpec.describe TrialStatusWidgetHelper do
end
describe
'#eligible_for_trial_status_widget?'
do
let
_it_be
(
:user
)
{
create
(
:u
ser
)
}
let
(
:user
)
{
instance_double
(
U
ser
)
}
let
(
:group
)
{
instance_double
(
Group
,
trial_active?:
trial_active
)
}
let
(
:user_can_admin_group
)
{
true
}
...
...
@@ -36,32 +38,19 @@ RSpec.describe TrialStatusWidgetHelper do
subject
{
helper
.
eligible_for_trial_status_widget?
(
group
)
}
context
'when the group has an active trial'
do
let
(
:trial_active
)
{
true
}
context
'and the user can admin the group'
do
let
(
:user_can_admin_group
)
{
true
}
it
{
is_expected
.
to
be_truthy
}
end
context
'but the user cannot admin the group'
do
let
(
:user_can_admin_group
)
{
false
}
it
{
is_expected
.
to
be_falsey
}
where
:trial_active
,
:user_can_admin_group
,
:expected_result
do
true
|
true
|
true
true
|
false
|
false
false
|
true
|
false
false
|
false
|
false
end
end
context
'when the group does not have an active trial'
do
let
(
:trial_active
)
{
false
}
it
{
is_expected
.
to
be_falsey
}
with_them
do
it
{
is_expected
.
to
eq
(
expected_result
)
}
end
end
describe
'#plan_title_for_group'
do
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:group
)
{
create
(
:group
)
}
subject
{
helper
.
plan_title_for_group
(
group
)
}
...
...
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