logo

mastofe

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

fan_out_on_write_service_spec.rb (1161B)


  1. require 'rails_helper'
  2. RSpec.describe FanOutOnWriteService do
  3. let(:author) { Fabricate(:account, username: 'tom') }
  4. let(:status) { Fabricate(:status, text: 'Hello @alice #test', account: author) }
  5. let(:alice) { Fabricate(:user, account: Fabricate(:account, username: 'alice')).account }
  6. let(:follower) { Fabricate(:account, username: 'bob') }
  7. subject { FanOutOnWriteService.new }
  8. before do
  9. alice
  10. follower.follow!(author)
  11. ProcessMentionsService.new.call(status)
  12. ProcessHashtagsService.new.call(status)
  13. subject.call(status)
  14. end
  15. it 'delivers status to home timeline' do
  16. expect(HomeFeed.new(author).get(10).map(&:id)).to include status.id
  17. end
  18. it 'delivers status to local followers' do
  19. pending 'some sort of problem in test environment causes this to sometimes fail'
  20. expect(HomeFeed.new(follower).get(10).map(&:id)).to include status.id
  21. end
  22. it 'delivers status to hashtag' do
  23. expect(Tag.find_by!(name: 'test').statuses.pluck(:id)).to include status.id
  24. end
  25. it 'delivers status to public timeline' do
  26. expect(Status.as_public_timeline(alice).map(&:id)).to include status.id
  27. end
  28. end