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
bdd752c9
Commit
bdd752c9
authored
Jul 20, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant contexts in specs
parent
c996970b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
70 deletions
+60
-70
ee/spec/helpers/ee/trial_helper_spec.rb
ee/spec/helpers/ee/trial_helper_spec.rb
+22
-28
ee/spec/models/ee/namespace_spec.rb
ee/spec/models/ee/namespace_spec.rb
+38
-42
No files found.
ee/spec/helpers/ee/trial_helper_spec.rb
View file @
bdd752c9
...
@@ -197,24 +197,20 @@ RSpec.describe EE::TrialHelper do
...
@@ -197,24 +197,20 @@ RSpec.describe EE::TrialHelper do
it
{
is_expected
.
to
be_falsey
}
it
{
is_expected
.
to
be_falsey
}
end
end
context
'when feature flag is enabled'
do
where
(
:can_extend_trial
,
:can_reactivate_trial
,
:result
)
do
where
(
:can_extend_trial
,
:can_reactivate_trial
,
:result
)
do
false
|
false
|
false
false
|
false
|
false
true
|
false
|
true
true
|
false
|
true
false
|
true
|
true
false
|
true
|
true
true
|
true
|
true
true
|
true
|
true
end
end
with_them
do
before
do
stub_feature_flags
(
allow_extend_reactivate_trial:
true
)
allow
(
namespace
).
to
receive
(
:can_extend_trial?
).
and_return
(
can_extend_trial
)
allow
(
namespace
).
to
receive
(
:can_reactivate_trial?
).
and_return
(
can_reactivate_trial
)
end
it
{
is_expected
.
to
eq
(
result
)
}
with_them
do
before
do
allow
(
namespace
).
to
receive
(
:can_extend_trial?
).
and_return
(
can_extend_trial
)
allow
(
namespace
).
to
receive
(
:can_reactivate_trial?
).
and_return
(
can_reactivate_trial
)
end
end
it
{
is_expected
.
to
eq
(
result
)
}
end
end
end
end
...
@@ -253,22 +249,20 @@ RSpec.describe EE::TrialHelper do
...
@@ -253,22 +249,20 @@ RSpec.describe EE::TrialHelper do
end
end
end
end
context
'when feature flag is enabled'
do
context
'when trial can be extended'
do
context
'when trial can be extended'
do
before
do
before
do
allow
(
namespace
).
to
receive
(
:can_extend_trial?
).
and_return
(
true
)
allow
(
namespace
).
to
receive
(
:can_extend_trial?
).
and_return
(
true
)
end
it
{
is_expected
.
to
eq
({
namespace_id:
1
,
plan_name:
'Ultimate'
,
action:
'extend'
})
}
end
end
context
'when trial can be reactivated'
do
it
{
is_expected
.
to
eq
({
namespace_id:
1
,
plan_name:
'Ultimate'
,
action:
'extend'
})
}
before
do
end
allow
(
namespace
).
to
receive
(
:can_reactivate_trial?
).
and_return
(
true
)
end
it
{
is_expected
.
to
eq
({
namespace_id:
1
,
plan_name:
'Ultimate'
,
action:
'reactivate'
})
}
context
'when trial can be reactivated'
do
before
do
allow
(
namespace
).
to
receive
(
:can_reactivate_trial?
).
and_return
(
true
)
end
end
it
{
is_expected
.
to
eq
({
namespace_id:
1
,
plan_name:
'Ultimate'
,
action:
'reactivate'
})
}
end
end
end
end
end
end
ee/spec/models/ee/namespace_spec.rb
View file @
bdd752c9
...
@@ -1261,22 +1261,20 @@ RSpec.describe Namespace do
...
@@ -1261,22 +1261,20 @@ RSpec.describe Namespace do
it
{
is_expected
.
to
be_falsey
}
it
{
is_expected
.
to
be_falsey
}
end
end
context
'when feature flag is enabled'
do
where
(
:trial_active
,
:trial_extended_or_reactivated
,
:can_extend_trial
)
do
where
(
:trial_active
,
:trial_extended_or_reactivated
,
:can_extend_trial
)
do
false
|
false
|
false
false
|
false
|
false
false
|
true
|
false
false
|
true
|
false
true
|
false
|
true
true
|
false
|
true
true
|
true
|
false
true
|
true
|
false
end
end
with_them
do
before
do
allow
(
namespace
).
to
receive
(
:trial_active?
).
and_return
(
trial_active
)
allow
(
namespace
).
to
receive
(
:trial_extended_or_reactivated?
).
and_return
(
trial_extended_or_reactivated
)
end
it
{
is_expected
.
to
be
can_extend_trial
}
with_them
do
before
do
allow
(
namespace
).
to
receive
(
:trial_active?
).
and_return
(
trial_active
)
allow
(
namespace
).
to
receive
(
:trial_extended_or_reactivated?
).
and_return
(
trial_extended_or_reactivated
)
end
end
it
{
is_expected
.
to
be
can_extend_trial
}
end
end
end
end
...
@@ -1296,36 +1294,34 @@ RSpec.describe Namespace do
...
@@ -1296,36 +1294,34 @@ RSpec.describe Namespace do
it
{
is_expected
.
to
be_falsey
}
it
{
is_expected
.
to
be_falsey
}
end
end
context
'when feature flag is enabled'
do
where
(
:trial_active
,
:never_had_trial
,
:trial_extended_or_reactivated
,
:free_plan
,
:can_reactivate_trial
)
do
where
(
:trial_active
,
:never_had_trial
,
:trial_extended_or_reactivated
,
:free_plan
,
:can_reactivate_trial
)
do
false
|
false
|
false
|
false
|
false
false
|
false
|
false
|
false
|
false
false
|
false
|
false
|
true
|
true
false
|
false
|
false
|
true
|
true
false
|
false
|
true
|
false
|
false
false
|
false
|
true
|
false
|
false
false
|
false
|
true
|
true
|
false
false
|
false
|
true
|
true
|
false
false
|
true
|
false
|
false
|
false
false
|
true
|
false
|
false
|
false
false
|
true
|
false
|
true
|
false
false
|
true
|
false
|
true
|
false
false
|
true
|
true
|
false
|
false
false
|
true
|
true
|
false
|
false
false
|
true
|
true
|
true
|
false
false
|
true
|
true
|
true
|
false
true
|
false
|
false
|
false
|
false
true
|
false
|
false
|
false
|
false
true
|
false
|
false
|
true
|
false
true
|
false
|
false
|
true
|
false
true
|
false
|
true
|
false
|
false
true
|
false
|
true
|
false
|
false
true
|
false
|
true
|
true
|
false
true
|
false
|
true
|
true
|
false
true
|
true
|
false
|
false
|
false
true
|
true
|
false
|
false
|
false
true
|
true
|
false
|
true
|
false
true
|
true
|
false
|
true
|
false
true
|
true
|
true
|
false
|
false
true
|
true
|
true
|
false
|
false
true
|
true
|
true
|
true
|
false
true
|
true
|
true
|
true
|
false
end
end
with_them
do
before
do
allow
(
namespace
).
to
receive
(
:trial_active?
).
and_return
(
trial_active
)
allow
(
namespace
).
to
receive
(
:never_had_trial?
).
and_return
(
never_had_trial
)
allow
(
namespace
).
to
receive
(
:trial_extended_or_reactivated?
).
and_return
(
trial_extended_or_reactivated
)
allow
(
namespace
).
to
receive
(
:free_plan?
).
and_return
(
free_plan
)
end
it
{
is_expected
.
to
be
can_reactivate_trial
}
with_them
do
before
do
allow
(
namespace
).
to
receive
(
:trial_active?
).
and_return
(
trial_active
)
allow
(
namespace
).
to
receive
(
:never_had_trial?
).
and_return
(
never_had_trial
)
allow
(
namespace
).
to
receive
(
:trial_extended_or_reactivated?
).
and_return
(
trial_extended_or_reactivated
)
allow
(
namespace
).
to
receive
(
:free_plan?
).
and_return
(
free_plan
)
end
end
it
{
is_expected
.
to
be
can_reactivate_trial
}
end
end
end
end
...
...
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