From c4d698917fab0e45de2287cff6c1ade93048be91 Mon Sep 17 00:00:00 2001 From: KMY Date: Sun, 24 Sep 2023 12:08:58 +0900 Subject: [PATCH] Add test --- .../services/process_mentions_service_spec.rb | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/spec/services/process_mentions_service_spec.rb b/spec/services/process_mentions_service_spec.rb index 0db73c41fabdbb..39bb355577ebf4 100644 --- a/spec/services/process_mentions_service_spec.rb +++ b/spec/services/process_mentions_service_spec.rb @@ -103,4 +103,27 @@ end end end + + context 'with circle post' do + let(:status) { Fabricate(:status, account: account) } + let(:circle) { Fabricate(:circle, account: account) } + let(:follower) { Fabricate(:account) } + let(:other) { Fabricate(:account) } + + before do + follower.follow!(account) + other.follow!(account) + circle.accounts << follower + described_class.new.call(status, limited_type: :circle, circle: circle) + end + + it 'remains circle post on history' do + expect(CircleStatus.exists?(circle_id: circle.id, status_id: status.id)).to be true + end + + it 'post is delivered to circle members' do + expect(status.mentioned_accounts.count).to eq 1 + expect(status.mentioned_accounts.first.id).to eq follower.id + end + end end