闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
852 B

  1. require 'rails_helper'
  2. RSpec.describe Settings::ProfilesController, type: :controller do
  3. render_views
  4. before do
  5. @user = Fabricate(:user)
  6. sign_in @user, scope: :user
  7. end
  8. describe "GET #show" do
  9. it "returns http success" do
  10. get :show
  11. expect(response).to have_http_status(200)
  12. end
  13. end
  14. describe 'PUT #update' do
  15. it 'updates the user profile' do
  16. allow(ActivityPub::UpdateDistributionWorker).to receive(:perform_async)
  17. account = Fabricate(:account, user: @user, display_name: 'Old name')
  18. put :update, params: { account: { display_name: 'New name' } }
  19. expect(account.reload.display_name).to eq 'New name'
  20. expect(response).to redirect_to(settings_profile_path)
  21. expect(ActivityPub::UpdateDistributionWorker).to have_received(:perform_async).with(account.id)
  22. end
  23. end
  24. end