about summary refs log tree commit diff
path: root/spec/controllers/settings
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/settings')
-rw-r--r--spec/controllers/settings/profiles_controller_spec.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/controllers/settings/profiles_controller_spec.rb b/spec/controllers/settings/profiles_controller_spec.rb
index b3d6bc47d..e502dbda7 100644
--- a/spec/controllers/settings/profiles_controller_spec.rb
+++ b/spec/controllers/settings/profiles_controller_spec.rb
@@ -4,7 +4,8 @@ RSpec.describe Settings::ProfilesController, type: :controller do
   render_views
 
   before do
-    sign_in Fabricate(:user), scope: :user
+    @user = Fabricate(:user)
+    sign_in @user, scope: :user
   end
 
   describe "GET #show" do
@@ -14,4 +15,13 @@ RSpec.describe Settings::ProfilesController, type: :controller do
     end
   end
 
+  describe 'PUT #update' do
+    it 'updates the user profile' do
+      account = Fabricate(:account, user: @user, display_name: 'Old name')
+
+      put :update, params: { account: { display_name: 'New name' } }
+      expect(account.reload.display_name).to eq 'New name'
+      expect(response).to redirect_to(settings_profile_path)
+    end
+  end
 end