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
36bc2e90
Commit
36bc2e90
authored
Jun 16, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix specs
parent
ef6a4240
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
19 deletions
+8
-19
app/controllers/admin/users_controller.rb
app/controllers/admin/users_controller.rb
+8
-7
spec/models/user_spec.rb
spec/models/user_spec.rb
+0
-12
No files found.
app/controllers/admin/users_controller.rb
View file @
36bc2e90
...
...
@@ -158,13 +158,14 @@ class Admin::UsersController < Admin::ApplicationController
user
.
update_secondary_emails!
end
if
result
[
:status
]
==
:success
format
.
html
{
redirect_back_or_admin_user
(
notice:
"Successfully removed email."
)
}
format
.
json
{
head
:ok
}
else
# restore username to keep form action url.
format
.
html
{
redirect_back_or_admin_user
(
notice:
result
[
:message
])
}
format
.
json
{
render
json:
result
[
:message
],
status:
result
[
:status
]
}
respond_to
do
|
format
|
if
result
[
:status
]
==
:success
format
.
html
{
redirect_back_or_admin_user
(
notice:
"Successfully removed email."
)
}
format
.
json
{
head
:ok
}
else
format
.
html
{
redirect_back_or_admin_user
(
alert:
result
[
:message
])
}
format
.
json
{
render
json:
result
[
:message
],
status:
result
[
:status
]
}
end
end
end
...
...
spec/models/user_spec.rb
View file @
36bc2e90
...
...
@@ -1899,16 +1899,4 @@ describe User, models: true do
user
.
invalidate_merge_request_cache_counts
end
end
describe
'audit changes'
do
let!
(
:user
)
{
create
(
:user
)
}
it
'audits an email change'
do
expect
{
user
.
update!
(
email:
'test@example.com'
)
}.
to
change
{
AuditEvent
.
count
}.
by
(
1
)
end
it
'audits a password change'
do
expect
{
user
.
update!
(
password:
'asdfasdf'
,
password_confirmation:
'asdfasdf'
)
}.
to
change
{
AuditEvent
.
count
}.
by
(
1
)
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