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
04bb82c8
Commit
04bb82c8
authored
Jun 15, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update preferences controller
parent
94980852
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
app/controllers/profiles/preferences_controller.rb
app/controllers/profiles/preferences_controller.rb
+3
-1
spec/controllers/profiles/preferences_controller_spec.rb
spec/controllers/profiles/preferences_controller_spec.rb
+3
-2
No files found.
app/controllers/profiles/preferences_controller.rb
View file @
04bb82c8
...
...
@@ -6,7 +6,9 @@ class Profiles::PreferencesController < Profiles::ApplicationController
def
update
begin
if
@user
.
update_attributes
(
preferences_params
)
result
=
Users
::
UpdateService
.
new
(
current_user
,
user
,
preferences_params
).
execute
if
result
[
:status
]
==
:success
flash
[
:notice
]
=
'Preferences saved.'
else
flash
[
:alert
]
=
'Failed to save preferences.'
...
...
spec/controllers/profiles/preferences_controller_spec.rb
View file @
04bb82c8
...
...
@@ -43,7 +43,8 @@ describe Profiles::PreferencesController do
dashboard:
'stars'
}.
with_indifferent_access
expect
(
user
).
to
receive
(
:update_attributes
).
with
(
prefs
)
expect
(
user
).
to
receive
(
:assign_attributes
).
with
(
prefs
)
expect
(
user
).
to
receive
(
:save
)
go
params:
prefs
end
...
...
@@ -51,7 +52,7 @@ describe Profiles::PreferencesController do
context
'on failed update'
do
it
'sets the flash'
do
expect
(
user
).
to
receive
(
:
update_attributes
).
and_return
(
false
)
expect
(
user
).
to
receive
(
:
save
).
and_return
(
false
)
go
...
...
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