logo

mastofe

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

follow_request_spec.rb (1235B)


  1. require 'rails_helper'
  2. RSpec.describe FollowRequest, type: :model do
  3. describe '#authorize!' do
  4. let(:follow_request) { Fabricate(:follow_request, account: account, target_account: target_account) }
  5. let(:account) { Fabricate(:account) }
  6. let(:target_account) { Fabricate(:account) }
  7. it 'calls Account#follow!, MergeWorker.perform_async, and #destroy!' do
  8. expect(account).to receive(:follow!).with(target_account, reblogs: true)
  9. expect(MergeWorker).to receive(:perform_async).with(target_account.id, account.id)
  10. expect(follow_request).to receive(:destroy!)
  11. follow_request.authorize!
  12. end
  13. it 'correctly passes show_reblogs when true' do
  14. follow_request = Fabricate.create(:follow_request, show_reblogs: true)
  15. follow_request.authorize!
  16. target = follow_request.target_account
  17. expect(follow_request.account.muting_reblogs?(target)).to be false
  18. end
  19. it 'correctly passes show_reblogs when false' do
  20. follow_request = Fabricate.create(:follow_request, show_reblogs: false)
  21. follow_request.authorize!
  22. target = follow_request.target_account
  23. expect(follow_request.account.muting_reblogs?(target)).to be true
  24. end
  25. end
  26. end