mirror of
https://github.com/funamitech/mastodon
synced 2024-12-21 10:08:26 +09:00
cb5b5cb5f7
* No need to re-require sidekiq plugins, they are required via Gemfile * Add derailed_benchmarks tool, no need to require TTY gems in Gemfile * Replace ruby-oembed with FetchOEmbedService Reduce startup by 45382 allocated objects * Remove preloaded JSON-LD in favour of caching HTTP responses Reduce boot RAM by about 6 MiB * Fix tests * Fix test suite by stubbing out JSON-LD contexts
38 lines
1.1 KiB
Ruby
38 lines
1.1 KiB
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe FanOutOnWriteService, type: :service do
|
|
let(:author) { Fabricate(:account, username: 'tom') }
|
|
let(:status) { Fabricate(:status, text: 'Hello @alice #test', account: author) }
|
|
let(:alice) { Fabricate(:user, account: Fabricate(:account, username: 'alice')).account }
|
|
let(:follower) { Fabricate(:account, username: 'bob') }
|
|
|
|
subject { FanOutOnWriteService.new }
|
|
|
|
before do
|
|
alice
|
|
follower.follow!(author)
|
|
|
|
ProcessMentionsService.new.call(status)
|
|
ProcessHashtagsService.new.call(status)
|
|
|
|
subject.call(status)
|
|
end
|
|
|
|
it 'delivers status to home timeline' do
|
|
expect(HomeFeed.new(author).get(10).map(&:id)).to include status.id
|
|
end
|
|
|
|
it 'delivers status to local followers' do
|
|
pending 'some sort of problem in test environment causes this to sometimes fail'
|
|
expect(HomeFeed.new(follower).get(10).map(&:id)).to include status.id
|
|
end
|
|
|
|
it 'delivers status to hashtag' do
|
|
expect(Tag.find_by!(name: 'test').statuses.pluck(:id)).to include status.id
|
|
end
|
|
|
|
it 'delivers status to public timeline' do
|
|
expect(Status.as_public_timeline(alice).map(&:id)).to include status.id
|
|
end
|
|
end
|