diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb index 84e2c91a85dfd4..0b8825135d1f68 100644 --- a/spec/models/concerns/account_interactions_spec.rb +++ b/spec/models/concerns/account_interactions_spec.rb @@ -9,6 +9,8 @@ let(:target_account) { Fabricate(:account, username: 'target') } let(:target_account_id) { target_account.id } let(:target_account_ids) { [target_account_id] } + let(:follower_account) { Fabricate(:account, username: 'follower') } + let(:followee_account) { Fabricate(:account, username: 'followee') } describe '.following_map' do subject { Account.following_map(target_account_ids, account_id) } @@ -711,4 +713,20 @@ expect(account.lists_for_local_distribution.to_a).to contain_exactly(follower_list, self_list) end end + + describe '#mutuals' do + subject { account.mutuals } + + context 'when following target_account' do + it 'mutual one' do + account.follow!(target_account) + target_account.follow!(account) + follower_account.follow!(account) + account.follow!(followee_account) + + expect(subject.count).to eq 1 + expect(subject.first.id).to eq target_account.id + end + end + end end diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb index c6c0b2d3efe207..3b953b9fc1fb65 100644 --- a/spec/services/post_status_service_spec.rb +++ b/spec/services/post_status_service_spec.rb @@ -188,6 +188,24 @@ expect(status.mentioned_accounts.first.id).to eq mutual_account.id end + it 'circle visibility' do + account = Fabricate(:account) + circle_account = Fabricate(:account) + other_account = Fabricate(:account) + circle = Fabricate(:circle, account: account) + text = 'This is an English text.' + + circle_account.follow!(account) + other_account.follow!(account) + circle.accounts << circle_account + status = subject.call(account, text: text, visibility: 'circle', circle_id: circle.id) + + expect(status.visibility).to eq 'limited' + expect(status.limited_scope).to eq 'circle' + expect(status.mentioned_accounts.count).to eq 1 + expect(status.mentioned_accounts.first.id).to eq circle_account.id + end + it 'safeguards mentions' do account = Fabricate(:account) mentioned_account = Fabricate(:account, username: 'alice')