Policies specs (#23924)

This commit is contained in:
Matt Jankowski 2023-03-04 10:57:22 -05:00 committed by GitHub
parent 6a57c42316
commit 00eb2269b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 393 additions and 3 deletions

View file

@ -39,6 +39,14 @@ RSpec.describe StatusPolicy, type: :model do
expect(subject).to permit(alice, status)
end
it 'grants access when direct and non-owner viewer is mentioned and mentions are loaded' do
status.visibility = :direct
status.mentions = [Fabricate(:mention, account: bob)]
status.mentions.load
expect(subject).to permit(bob, status)
end
it 'denies access when direct and viewer is not mentioned' do
viewer = Fabricate(:account)
status.visibility = :direct