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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
83c1bb68
Commit
83c1bb68
authored
Sep 07, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add has_auto_devops_implicitly_disabled
parent
d02f36d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
2 deletions
+49
-2
app/helpers/auto_devops_helper.rb
app/helpers/auto_devops_helper.rb
+1
-2
app/models/project.rb
app/models/project.rb
+4
-0
spec/models/project_spec.rb
spec/models/project_spec.rb
+44
-0
No files found.
app/helpers/auto_devops_helper.rb
View file @
83c1bb68
...
@@ -2,7 +2,6 @@ module AutoDevopsHelper
...
@@ -2,7 +2,6 @@ module AutoDevopsHelper
def
show_auto_devops_callout?
(
project
)
def
show_auto_devops_callout?
(
project
)
show_callout?
(
'auto_devops_settings_dismissed'
)
&&
show_callout?
(
'auto_devops_settings_dismissed'
)
&&
can?
(
current_user
,
:admin_pipeline
,
project
)
&&
can?
(
current_user
,
:admin_pipeline
,
project
)
&&
!
current_application_settings
.
auto_devops_enabled?
&&
project
.
has_auto_devops_implicitly_disabled?
project
.
auto_devops
&
.
enabled
.
nil?
end
end
end
end
app/models/project.rb
View file @
83c1bb68
...
@@ -477,6 +477,10 @@ class Project < ActiveRecord::Base
...
@@ -477,6 +477,10 @@ class Project < ActiveRecord::Base
end
end
end
end
def
has_auto_devops_implicitly_disabled?
auto_devops
&
.
enabled
.
nil?
&&
!
current_application_settings
.
auto_devops_enabled?
end
def
repository_storage_path
def
repository_storage_path
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
].
try
(
:[]
,
'path'
)
Gitlab
.
config
.
repositories
.
storages
[
repository_storage
].
try
(
:[]
,
'path'
)
end
end
...
...
spec/models/project_spec.rb
View file @
83c1bb68
...
@@ -2607,6 +2607,50 @@ describe Project do
...
@@ -2607,6 +2607,50 @@ describe Project do
end
end
end
end
describe
'#has_auto_devops_implicitly_disabled?'
do
set
(
:project
)
{
create
(
:project
)
}
context
'when enabled in settings'
do
before
do
stub_application_setting
(
auto_devops_enabled:
true
)
end
it
'does not have auto devops implicitly disabled'
do
expect
(
project
).
not_to
have_auto_devops_implicitly_disabled
end
end
context
'when disabled in settings'
do
before
do
stub_application_setting
(
auto_devops_enabled:
false
)
end
it
'auto devops is implicitly disabled'
do
expect
(
project
).
to
have_auto_devops_implicitly_disabled
end
context
'when explicitly disabled'
do
before
do
create
(
:project_auto_devops
,
project:
project
,
enabled:
false
)
end
it
'does not have auto devops implicitly disabled'
do
expect
(
project
).
not_to
have_auto_devops_implicitly_disabled
end
end
context
'when explicitly enabled'
do
before
do
create
(
:project_auto_devops
,
project:
project
)
end
it
'does not have auto devops implicitly disabled'
do
expect
(
project
).
not_to
have_auto_devops_implicitly_disabled
end
end
end
end
context
'#auto_devops_variables'
do
context
'#auto_devops_variables'
do
set
(
:project
)
{
create
(
:project
)
}
set
(
:project
)
{
create
(
:project
)
}
...
...
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