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
Jérome Perrin
gitlab-ce
Commits
ad44af2f
Commit
ad44af2f
authored
Jun 16, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed specs
parent
7aaf3692
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
lib/api/users.rb
lib/api/users.rb
+1
-1
spec/services/emails/create_service_spec.rb
spec/services/emails/create_service_spec.rb
+1
-1
spec/services/emails/destroy_service_spec.rb
spec/services/emails/destroy_service_spec.rb
+4
-2
No files found.
lib/api/users.rb
View file @
ad44af2f
...
...
@@ -511,7 +511,7 @@ module API
not_found!
(
'Email'
)
unless
email
email
.
destroy
::
Users
::
UpdateService
.
new
(
current_user
,
user
).
execute
do
|
user
|
::
Users
::
UpdateService
.
new
(
current_user
,
current_
user
).
execute
do
|
user
|
user
.
update_secondary_emails!
end
end
...
...
spec/services/emails/create_service_spec.rb
View file @
ad44af2f
...
...
@@ -19,7 +19,7 @@ describe Emails::CreateService, services: true do
end
it
'does not create an email if the user has no permissions'
do
expect
{
described_class
.
new
(
create
(
:user
),
user
,
opts
).
execute
}.
not_to
change
{
Email
.
count
}
expect
{
described_class
.
new
(
create
(
:user
),
user
,
opts
).
execute
}.
to
raise_error
(
Gitlab
::
Access
::
AccessDeniedError
)
end
it
'creates an email if we skip authorization'
do
...
...
spec/services/emails/destroy_service_spec.rb
View file @
ad44af2f
...
...
@@ -12,12 +12,14 @@ describe Emails::DestroyService, services: true do
end
it
'does not remove an email if the user has no permissions'
do
expect
{
described_class
.
new
(
create
(
:user
),
user
,
opts
).
execute
}.
not_to
change
{
Email
.
count
}
expect
do
described_class
.
new
(
create
(
:user
),
user
,
email:
email
.
email
).
execute
end
.
to
raise_error
(
Gitlab
::
Access
::
AccessDeniedError
)
end
it
'removes an email if we skip authorization'
do
expect
do
described_class
.
new
(
create
(
:user
),
user
,
opts
).
execute
(
skip_authorization:
true
)
described_class
.
new
(
create
(
:user
),
user
,
email:
email
.
email
).
execute
(
skip_authorization:
true
)
end
.
to
change
{
Email
.
count
}.
by
(
-
1
)
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