Skip to content
Snippets Groups Projects
Commit 04bb82c8 authored by James Lopez's avatar James Lopez
Browse files

update preferences controller

parent 94980852
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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.'
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment