Test: #76 StatusPolicyにおける拡張ドメインブロックのテスト (#477)

This commit is contained in:
KMY(雪あすか) 2024-01-18 08:54:37 +09:00 committed by GitHub
parent d5940f00d3
commit f20ebfac41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -112,6 +112,21 @@ RSpec.describe StatusPolicy, type: :model do
expect(subject).to_not permit(viewer, status) expect(subject).to_not permit(viewer, status)
end 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
end end