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
Tatuya Kamada
gitlab-ce
Commits
4c3ec579
Commit
4c3ec579
authored
Dec 21, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added more specs
parent
fd5062a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+2
-0
spec/controllers/groups_controller_spec.rb
spec/controllers/groups_controller_spec.rb
+2
-2
spec/services/groups/update_service_spec.rb
spec/services/groups/update_service_spec.rb
+4
-2
No files found.
app/controllers/groups_controller.rb
View file @
4c3ec579
...
@@ -82,6 +82,8 @@ class GroupsController < Groups::ApplicationController
...
@@ -82,6 +82,8 @@ class GroupsController < Groups::ApplicationController
if
Groups
::
UpdateService
.
new
(
@group
,
current_user
,
group_params
).
execute
if
Groups
::
UpdateService
.
new
(
@group
,
current_user
,
group_params
).
execute
redirect_to
edit_group_path
(
@group
),
notice:
"Group '
#{
@group
.
name
}
' was successfully updated."
redirect_to
edit_group_path
(
@group
),
notice:
"Group '
#{
@group
.
name
}
' was successfully updated."
else
else
@group
.
reload
render
action:
"edit"
render
action:
"edit"
end
end
end
end
...
...
spec/controllers/groups_controller_spec.rb
View file @
4c3ec579
...
@@ -122,8 +122,8 @@ describe GroupsController do
...
@@ -122,8 +122,8 @@ describe GroupsController do
allow_any_instance_of
(
Group
).
to
receive
(
:move_dir
).
and_raise
(
Gitlab
::
UpdatePathError
)
allow_any_instance_of
(
Group
).
to
receive
(
:move_dir
).
and_raise
(
Gitlab
::
UpdatePathError
)
post
:update
,
id:
group
.
to_param
,
group:
{
path:
'new_path'
}
post
:update
,
id:
group
.
to_param
,
group:
{
path:
'new_path'
}
expect
(
response
).
to
have_http_status
(
302
)
expect
(
assigns
(
:group
).
errors
).
not_to
be_empty
expect
(
controller
).
to
set_flash
[
:alert
]
expect
(
assigns
(
:group
).
path
).
not_to
eq
(
'new_path'
)
end
end
end
end
end
end
spec/services/groups/update_service_spec.rb
View file @
4c3ec579
...
@@ -59,8 +59,6 @@ describe Groups::UpdateService, services: true do
...
@@ -59,8 +59,6 @@ describe Groups::UpdateService, services: true do
end
end
it
'returns true'
do
it
'returns true'
do
puts
internal_group
.
errors
.
full_messages
expect
(
service
.
execute
).
to
eq
(
true
)
expect
(
service
.
execute
).
to
eq
(
true
)
end
end
...
@@ -82,6 +80,10 @@ describe Groups::UpdateService, services: true do
...
@@ -82,6 +80,10 @@ describe Groups::UpdateService, services: true do
expect
(
internal_group
.
errors
.
full_messages
.
first
).
to
eq
(
'Gitlab::UpdatePathError'
)
expect
(
internal_group
.
errors
.
full_messages
.
first
).
to
eq
(
'Gitlab::UpdatePathError'
)
end
end
it
"hasn't changed the path"
do
expect
{
service
.
execute
}.
not_to
change
{
internal_group
.
reload
.
path
}
end
end
end
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