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
11044ab1
Commit
11044ab1
authored
Jun 13, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix spec
parent
5f0e7873
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
spec/services/users/update_service_spec.rb
spec/services/users/update_service_spec.rb
+5
-6
No files found.
spec/services/users/update_service_spec.rb
View file @
11044ab1
...
@@ -3,7 +3,6 @@ require 'spec_helper'
...
@@ -3,7 +3,6 @@ require 'spec_helper'
describe
Users
::
UpdateService
,
services:
true
do
describe
Users
::
UpdateService
,
services:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:admin
)
{
create
(
:admin
)
}
let
(
:user
)
{
create
(
:empty_user
,
creator_id:
user
.
id
,
namespace:
user
.
namespace
)
}
describe
'#execute'
do
describe
'#execute'
do
it
'updates the name'
do
it
'updates the name'
do
...
@@ -14,20 +13,20 @@ describe Users::UpdateService, services: true do
...
@@ -14,20 +13,20 @@ describe Users::UpdateService, services: true do
context
'when updated by an admin'
do
context
'when updated by an admin'
do
it
'updates the name'
do
it
'updates the name'
do
result
=
update_user
(
user
,
admin
,
name:
'New Name'
)
result
=
update_user
(
admin
,
user
,
name:
'New Name'
)
expect
(
result
).
to
eq
({
status: :success
})
expect
(
result
).
to
eq
({
status: :success
})
expect
(
user
.
name
).
to
eq
(
'New Name'
)
expect
(
user
.
name
).
to
eq
(
'New Name'
)
end
end
end
end
it
'returns an error result when record cannot be updated'
do
it
'returns an error result when record cannot be updated'
do
result
=
update_user
(
user
,
create
(
:user
),
{
name:
'New Name'
})
expect
do
update_user
(
user
,
create
(
:user
),
{
name:
'New Name'
})
e
xpect
(
result
).
to
eq
({
status: :error
,
message:
'User could not be updated'
})
e
nd
.
to
raise_error
Gitlab
::
Access
::
AccessDeniedError
end
end
def
update_user
(
current_user
,
user
,
opts
)
def
update_user
(
current_user
,
user
,
opts
)
described_class
.
new
(
user
,
user
,
opts
).
execute
described_class
.
new
(
current_
user
,
user
,
opts
).
execute
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