From f20ebfac41a82802d9b4f0db812ee3ee2aa30b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?KMY=EF=BC=88=E9=9B=AA=E3=81=82=E3=81=99=E3=81=8B=EF=BC=89?= Date: Thu, 18 Jan 2024 08:54:37 +0900 Subject: [PATCH] =?UTF-8?q?Test:=20#76=20`StatusPolicy`=E3=81=AB=E3=81=8A?= =?UTF-8?q?=E3=81=91=E3=82=8B=E6=8B=A1=E5=BC=B5=E3=83=89=E3=83=A1=E3=82=A4?= =?UTF-8?q?=E3=83=B3=E3=83=96=E3=83=AD=E3=83=83=E3=82=AF=E3=81=AE=E3=83=86?= =?UTF-8?q?=E3=82=B9=E3=83=88=20(#477)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/policies/status_policy_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/policies/status_policy_spec.rb b/spec/policies/status_policy_spec.rb index 6bfc02c582..a6c71e0cb0 100644 --- a/spec/policies/status_policy_spec.rb +++ b/spec/policies/status_policy_spec.rb @@ -112,6 +112,21 @@ RSpec.describe StatusPolicy, type: :model do expect(subject).to_not permit(viewer, status) end + + context 'with remote account' do + let(:viewer) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') } + let(:status) { Fabricate(:status, account: alice, spoiler_text: 'ohagi', sensitive: true) } + + it 'grants access when viewer is not domain-blocked' do + expect(subject).to permit(viewer, status) + end + + it 'denies access when viewer is domain-blocked' do + Fabricate(:domain_block, domain: 'example.com', severity: :noop, reject_send_sensitive: true) + + expect(subject).to_not permit(viewer, status) + end + end end end