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
771304fa
Commit
771304fa
authored
Sep 17, 2019
by
Eugenia Grieff
Committed by
Robert Speicher
Sep 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check message presence in EE::RunnersHelper
Add missing specs for EE::RunnersHelper Add changelog file
parent
9a5b73d9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
changelogs/unreleased/32156-fix-ci_usage_warning_message-message-builder.yml
...ed/32156-fix-ci_usage_warning_message-message-builder.yml
+5
-0
ee/app/helpers/ee/runners_helper.rb
ee/app/helpers/ee/runners_helper.rb
+1
-1
ee/spec/helpers/ee/runners_helper_spec.rb
ee/spec/helpers/ee/runners_helper_spec.rb
+22
-2
No files found.
changelogs/unreleased/32156-fix-ci_usage_warning_message-message-builder.yml
0 → 100644
View file @
771304fa
---
title
:
Prevent the user from seeing an invalid "Purchase more minutes" prompt.
merge_request
:
16979
author
:
type
:
fixed
ee/app/helpers/ee/runners_helper.rb
View file @
771304fa
...
@@ -4,7 +4,7 @@ module EE
...
@@ -4,7 +4,7 @@ module EE
def
ci_usage_warning_message
(
namespace
,
project
)
def
ci_usage_warning_message
(
namespace
,
project
)
message
=
[
ci_usage_base_message
(
namespace
)]
message
=
[
ci_usage_base_message
(
namespace
)]
return
unless
message
return
unless
message
.
any?
if
::
Gitlab
.
com?
&&
can?
(
current_user
,
:admin_project
,
project
)
if
::
Gitlab
.
com?
&&
can?
(
current_user
,
:admin_project
,
project
)
message
<<
purchase_shared_runner_minutes_link
message
<<
purchase_shared_runner_minutes_link
...
...
ee/spec/helpers/ee/runners_helper_spec.rb
View file @
771304fa
...
@@ -29,8 +29,8 @@ describe EE::RunnersHelper do
...
@@ -29,8 +29,8 @@ describe EE::RunnersHelper do
context
'when CI minutes quota is above the warning limits'
do
context
'when CI minutes quota is above the warning limits'
do
let
(
:minutes_used
)
{
40
}
let
(
:minutes_used
)
{
40
}
it
'
does not return a message
'
do
it
'
returns nil
'
do
expect
(
subject
).
to
be_
empty
expect
(
subject
).
to
be_
nil
end
end
end
end
...
@@ -39,6 +39,16 @@ describe EE::RunnersHelper do
...
@@ -39,6 +39,16 @@ describe EE::RunnersHelper do
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:admin_project
,
project
)
{
true
}
allow
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:admin_project
,
project
)
{
true
}
end
end
context
'when base message is not present'
do
before
do
allow
(
helper
).
to
receive
(
:ci_usage_base_message
).
with
(
namespace
).
and_return
(
nil
)
end
it
'returns nil'
do
expect
(
subject
).
to
be_nil
end
end
context
'when usage has reached first level of notification'
do
context
'when usage has reached first level of notification'
do
before
do
before
do
namespace
.
update_attribute
(
:last_ci_minutes_usage_notification_level
,
50
)
namespace
.
update_attribute
(
:last_ci_minutes_usage_notification_level
,
50
)
...
@@ -61,6 +71,16 @@ describe EE::RunnersHelper do
...
@@ -61,6 +71,16 @@ describe EE::RunnersHelper do
end
end
context
'when current user is not an owner'
do
context
'when current user is not an owner'
do
context
'when base message is not present'
do
before
do
allow
(
helper
).
to
receive
(
:ci_usage_base_message
).
with
(
namespace
).
and_return
(
nil
)
end
it
'returns nil'
do
expect
(
subject
).
to
be_nil
end
end
context
'when usage has reached first level of notification'
do
context
'when usage has reached first level of notification'
do
before
do
before
do
namespace
.
update_attribute
(
:last_ci_minutes_usage_notification_level
,
50
)
namespace
.
update_attribute
(
:last_ci_minutes_usage_notification_level
,
50
)
...
...
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