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
cf628631
Commit
cf628631
authored
Jun 13, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added bang option to spec
parent
11044ab1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
spec/services/users/update_service_spec.rb
spec/services/users/update_service_spec.rb
+30
-0
No files found.
spec/services/users/update_service_spec.rb
View file @
cf628631
...
...
@@ -7,6 +7,7 @@ describe Users::UpdateService, services: true do
describe
'#execute'
do
it
'updates the name'
do
result
=
update_user
(
user
,
user
,
name:
'New Name'
)
expect
(
result
).
to
eq
({
status: :success
})
expect
(
user
.
name
).
to
eq
(
'New Name'
)
end
...
...
@@ -14,6 +15,7 @@ describe Users::UpdateService, services: true do
context
'when updated by an admin'
do
it
'updates the name'
do
result
=
update_user
(
admin
,
user
,
name:
'New Name'
)
expect
(
result
).
to
eq
({
status: :success
})
expect
(
user
.
name
).
to
eq
(
'New Name'
)
end
...
...
@@ -29,4 +31,32 @@ describe Users::UpdateService, services: true do
described_class
.
new
(
current_user
,
user
,
opts
).
execute
end
end
describe
'#execute!'
do
it
'updates the name'
do
result
=
update_user
(
user
,
user
,
name:
'New Name'
)
expect
(
result
).
to
be
true
expect
(
user
.
name
).
to
eq
(
'New Name'
)
end
context
'when updated by an admin'
do
it
'updates the name'
do
result
=
update_user
(
admin
,
user
,
name:
'New Name'
)
expect
(
result
).
to
be
true
expect
(
user
.
name
).
to
eq
(
'New Name'
)
end
end
it
'returns an error result when record cannot be updated'
do
expect
do
update_user
(
user
,
create
(
:user
),
{
name:
'New Name'
})
end
.
to
raise_error
Gitlab
::
Access
::
AccessDeniedError
end
def
update_user
(
current_user
,
user
,
opts
)
described_class
.
new
(
current_user
,
user
,
opts
).
execute!
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