logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

profiles_controller_spec.rb (857B)


  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(:success)
  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