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
8c434a52
Commit
8c434a52
authored
Jul 06, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gb nice catches
parent
61d5b138
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
12 deletions
+12
-12
app/controllers/groups/variables_controller.rb
app/controllers/groups/variables_controller.rb
+5
-5
app/controllers/projects/variables_controller.rb
app/controllers/projects/variables_controller.rb
+5
-5
spec/controllers/groups/variables_controller_spec.rb
spec/controllers/groups/variables_controller_spec.rb
+1
-1
spec/controllers/projects/variables_controller_spec.rb
spec/controllers/projects/variables_controller_spec.rb
+1
-1
No files found.
app/controllers/groups/variables_controller.rb
View file @
8c434a52
...
@@ -20,13 +20,13 @@ module Groups
...
@@ -20,13 +20,13 @@ module Groups
end
end
def
create
def
create
new_variable
=
group
.
variables
.
create
(
group_params
)
@variable
=
group
.
variables
.
create
(
group_params
)
.
present
(
current_user:
current_user
)
if
new_
variable
.
persisted?
if
@
variable
.
persisted?
redirect_to
group_settings_ci_cd_path
(
group
),
redirect_to
group_settings_ci_cd_path
(
group
),
notice:
'Variable
s were successfully upd
ated.'
notice:
'Variable
was successfully cre
ated.'
else
else
@variable
=
new_variable
.
present
(
current_user:
current_user
)
render
"show"
render
"show"
end
end
end
end
...
@@ -39,7 +39,7 @@ module Groups
...
@@ -39,7 +39,7 @@ module Groups
else
else
redirect_to
group_settings_ci_cd_path
(
group
),
redirect_to
group_settings_ci_cd_path
(
group
),
status:
302
,
status:
302
,
notice:
'Failed to remove the variable'
notice:
'Failed to remove the variable
.
'
end
end
end
end
...
...
app/controllers/projects/variables_controller.rb
View file @
8c434a52
...
@@ -21,13 +21,13 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -21,13 +21,13 @@ class Projects::VariablesController < Projects::ApplicationController
end
end
def
create
def
create
new_variable
=
project
.
variables
.
create
(
project_params
)
@variable
=
project
.
variables
.
create
(
project_params
)
.
present
(
current_user:
current_user
)
if
new_
variable
.
persisted?
if
@
variable
.
persisted?
redirect_to
project_settings_ci_cd_path
(
project
),
redirect_to
project_settings_ci_cd_path
(
project
),
notice:
'Variable
s were successfully upd
ated.'
notice:
'Variable
was successfully cre
ated.'
else
else
@variable
=
new_variable
.
present
(
current_user:
current_user
)
render
"show"
render
"show"
end
end
end
end
...
@@ -40,7 +40,7 @@ class Projects::VariablesController < Projects::ApplicationController
...
@@ -40,7 +40,7 @@ class Projects::VariablesController < Projects::ApplicationController
else
else
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
redirect_to
namespace_project_settings_ci_cd_path
(
project
.
namespace
,
project
),
status:
302
,
status:
302
,
notice:
'Failed to remove the variable'
notice:
'Failed to remove the variable
.
'
end
end
end
end
...
...
spec/controllers/groups/variables_controller_spec.rb
View file @
8c434a52
...
@@ -14,7 +14,7 @@ describe Groups::VariablesController do
...
@@ -14,7 +14,7 @@ describe Groups::VariablesController do
it
'shows a success flash message'
do
it
'shows a success flash message'
do
post
:create
,
group_id:
group
,
variable:
{
key:
"one"
,
value:
"two"
}
post
:create
,
group_id:
group
,
variable:
{
key:
"one"
,
value:
"two"
}
expect
(
flash
[
:notice
]).
to
include
'Variable
s were successfully upd
ated.'
expect
(
flash
[
:notice
]).
to
include
'Variable
was successfully cre
ated.'
expect
(
response
).
to
redirect_to
(
group_settings_ci_cd_path
(
group
))
expect
(
response
).
to
redirect_to
(
group_settings_ci_cd_path
(
group
))
end
end
end
end
...
...
spec/controllers/projects/variables_controller_spec.rb
View file @
8c434a52
...
@@ -15,7 +15,7 @@ describe Projects::VariablesController do
...
@@ -15,7 +15,7 @@ describe Projects::VariablesController do
post
:create
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
post
:create
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
,
variable:
{
key:
"one"
,
value:
"two"
}
variable:
{
key:
"one"
,
value:
"two"
}
expect
(
flash
[
:notice
]).
to
include
'Variable
s were successfully upd
ated.'
expect
(
flash
[
:notice
]).
to
include
'Variable
was successfully cre
ated.'
expect
(
response
).
to
redirect_to
(
project_settings_ci_cd_path
(
project
))
expect
(
response
).
to
redirect_to
(
project_settings_ci_cd_path
(
project
))
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