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
56bcb3e8
Commit
56bcb3e8
authored
Feb 03, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Gitlab::CurrentSettings instead of current_application_settings
parent
bf278f79
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
9 deletions
+7
-9
app/models/project_auto_devops.rb
app/models/project_auto_devops.rb
+1
-3
spec/features/admin/admin_settings_spec.rb
spec/features/admin/admin_settings_spec.rb
+2
-2
spec/models/project_auto_devops_spec.rb
spec/models/project_auto_devops_spec.rb
+4
-4
No files found.
app/models/project_auto_devops.rb
View file @
56bcb3e8
class
ProjectAutoDevops
<
ActiveRecord
::
Base
class
ProjectAutoDevops
<
ActiveRecord
::
Base
include
Gitlab
::
CurrentSettings
belongs_to
:project
belongs_to
:project
scope
:enabled
,
->
{
where
(
enabled:
true
)
}
scope
:enabled
,
->
{
where
(
enabled:
true
)
}
...
@@ -9,7 +7,7 @@ class ProjectAutoDevops < ActiveRecord::Base
...
@@ -9,7 +7,7 @@ class ProjectAutoDevops < ActiveRecord::Base
validates
:domain
,
allow_blank:
true
,
hostname:
{
allow_numeric_hostname:
true
}
validates
:domain
,
allow_blank:
true
,
hostname:
{
allow_numeric_hostname:
true
}
def
instance_domain
def
instance_domain
current_application_s
ettings
.
auto_devops_domain
Gitlab
::
CurrentS
ettings
.
auto_devops_domain
end
end
def
has_domain?
def
has_domain?
...
...
spec/features/admin/admin_settings_spec.rb
View file @
56bcb3e8
...
@@ -52,8 +52,8 @@ feature 'Admin updates settings' do
...
@@ -52,8 +52,8 @@ feature 'Admin updates settings' do
fill_in
'Auto devops domain'
,
with:
'domain.com'
fill_in
'Auto devops domain'
,
with:
'domain.com'
click_button
'Save'
click_button
'Save'
expect
(
current_application_s
ettings
.
auto_devops_enabled?
).
to
be
true
expect
(
Gitlab
::
CurrentS
ettings
.
auto_devops_enabled?
).
to
be
true
expect
(
current_application_s
ettings
.
auto_devops_domain
).
to
eq
(
'domain.com'
)
expect
(
Gitlab
::
CurrentS
ettings
.
auto_devops_domain
).
to
eq
(
'domain.com'
)
expect
(
page
).
to
have_content
"Application settings saved successfully"
expect
(
page
).
to
have_content
"Application settings saved successfully"
end
end
...
...
spec/models/project_auto_devops_spec.rb
View file @
56bcb3e8
...
@@ -20,7 +20,7 @@ describe ProjectAutoDevops do
...
@@ -20,7 +20,7 @@ describe ProjectAutoDevops do
context
'when there is an instance domain specified'
do
context
'when there is an instance domain specified'
do
before
do
before
do
stub_application_setting
(
auto_devops_domain:
'example.com'
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:auto_devops_domain
).
and_return
(
'example.com'
)
end
end
it
{
expect
(
auto_devops
).
to
have_domain
}
it
{
expect
(
auto_devops
).
to
have_domain
}
...
@@ -28,7 +28,7 @@ describe ProjectAutoDevops do
...
@@ -28,7 +28,7 @@ describe ProjectAutoDevops do
context
'when there is no instance domain specified'
do
context
'when there is no instance domain specified'
do
before
do
before
do
stub_application_setting
(
auto_devops_domain:
nil
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:auto_devops_domain
).
and_return
(
nil
)
end
end
it
{
expect
(
auto_devops
).
not_to
have_domain
}
it
{
expect
(
auto_devops
).
not_to
have_domain
}
...
@@ -52,7 +52,7 @@ describe ProjectAutoDevops do
...
@@ -52,7 +52,7 @@ describe ProjectAutoDevops do
context
'when there is an instance domain specified'
do
context
'when there is an instance domain specified'
do
before
do
before
do
stub_application_setting
(
auto_devops_domain:
'example.com'
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:auto_devops_domain
).
and_return
(
'example.com'
)
end
end
it
{
expect
(
auto_devops
.
variables
).
to
include
(
domain_variable
)
}
it
{
expect
(
auto_devops
.
variables
).
to
include
(
domain_variable
)
}
...
@@ -60,7 +60,7 @@ describe ProjectAutoDevops do
...
@@ -60,7 +60,7 @@ describe ProjectAutoDevops do
context
'when there is no instance domain specified'
do
context
'when there is no instance domain specified'
do
before
do
before
do
stub_application_setting
(
auto_devops_domain:
nil
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:auto_devops_domain
).
and_return
(
nil
)
end
end
it
{
expect
(
auto_devops
.
variables
).
not_to
include
(
domain_variable
)
}
it
{
expect
(
auto_devops
.
variables
).
not_to
include
(
domain_variable
)
}
...
...
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