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
b3e2cbf3
Commit
b3e2cbf3
authored
Apr 12, 2022
by
Serena Fang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix namespace helper specs
parent
5c45890f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
17 deletions
+41
-17
spec/helpers/namespaces_helper_spec.rb
spec/helpers/namespaces_helper_spec.rb
+41
-17
No files found.
spec/helpers/namespaces_helper_spec.rb
View file @
b3e2cbf3
...
...
@@ -272,29 +272,45 @@ RSpec.describe NamespacesHelper do
describe
'#show_minute_limit_banner?'
do
let
(
:project
)
{
create
(
:project
)
}
context
'
when show_minute_limit_banner feature flag enabled
'
do
context
'
on dot com
'
do
before
do
stub_feature_flags
(
show_minute_limit_banner:
true
)
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
true
)
end
context
'
for a free project
'
do
context
'
when show_minute_limit_banner feature flag enabled
'
do
before
do
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
true
)
stub_feature_flags
(
show_minute_limit_banner:
true
)
end
context
'
when user has not dismissed banner
'
do
context
'
for a free project
'
do
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
fals
e
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
tru
e
)
end
it
'shows the banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
true
)
context
'when user has not dismissed banner'
do
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
false
)
end
it
'shows the banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
true
)
end
end
context
'when user has dismissed banner'
do
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
true
)
end
it
'does not show the banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
false
)
end
end
end
context
'
when user has dismissed banner
'
do
context
'
for a non-free project
'
do
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
tru
e
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
fals
e
)
end
it
'does not show the banner'
do
...
...
@@ -303,24 +319,32 @@ RSpec.describe NamespacesHelper do
end
end
context
'
for a non-free project
'
do
context
'
when show_minute_limit_banner feature flag is not enabled
'
do
before
do
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
false
)
stub_feature_flags
(
show_minute_limit_banner:
false
)
end
it
'does not show the banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
false
)
context
'for a free project and user has not dismissed callout'
do
before
do
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
false
)
end
it
'does not show banner'
do
expect
(
helper
.
show_minute_limit_banner?
(
project
)).
to
eq
(
false
)
end
end
end
end
context
'
when show_minute_limit_banner feature flag is not enabled
'
do
context
'
not dot com
'
do
before
do
stub_feature_flags
(
show_minute_limit_banner:
false
)
allow
(
Gitlab
).
to
receive
(
:com?
).
and_return
(
false
)
end
context
'for a free project and user has not dismissed callout'
do
context
'
when feature flag is enabled
for a free project and user has not dismissed callout'
do
before
do
stub_feature_flags
(
show_minute_limit_banner:
true
)
allow
(
project
.
root_ancestor
).
to
receive
(
:free_plan?
).
and_return
(
true
)
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
Users
::
CalloutsHelper
::
MINUTE_LIMIT_BANNER
).
and_return
(
false
)
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