diff options
author | Jack Jennings <jack@standard-library.com> | 2017-05-29 09:22:22 -0700 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-29 18:22:22 +0200 |
commit | 3a2003ba863252f305fb32098bcd3f095b10e2ff (patch) | |
tree | 6ff5f4a1cf6c9d042baca1441409afb9ac46775d /spec/models | |
parent | 9a81be0d3715eb846d940794f8b34cbbe4ba67a5 (diff) |
Extract authorization policy for viewing statuses (#3150)
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/status_spec.rb | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index d3a66134b..ec07e6156 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -119,66 +119,6 @@ RSpec.describe Status, type: :model do end end - describe '#permitted?' do - it 'returns true when direct and account is viewer' do - subject.visibility = :direct - expect(subject.permitted?(subject.account)).to be true - end - - it 'returns true when direct and viewer is mentioned' do - subject.visibility = :direct - subject.mentions = [Fabricate(:mention, account: alice)] - - expect(subject.permitted?(alice)).to be true - end - - it 'returns false when direct and viewer is not mentioned' do - viewer = Fabricate(:account) - subject.visibility = :direct - - expect(subject.permitted?(viewer)).to be false - end - - it 'returns true when private and account is viewer' do - subject.visibility = :direct - expect(subject.permitted?(subject.account)).to be true - end - - it 'returns true when private and account is following viewer' do - follow = Fabricate(:follow) - subject.visibility = :private - subject.account = follow.target_account - - expect(subject.permitted?(follow.account)).to be true - end - - it 'returns true when private and viewer is mentioned' do - subject.visibility = :private - subject.mentions = [Fabricate(:mention, account: alice)] - - expect(subject.permitted?(alice)).to be true - end - - it 'returns false when private and viewer is not mentioned or followed' do - viewer = Fabricate(:account) - subject.visibility = :private - - expect(subject.permitted?(viewer)).to be false - end - - it 'returns true when no viewer' do - expect(subject.permitted?).to be true - end - - it 'returns false when viewer is blocked' do - block = Fabricate(:block) - subject.visibility = :private - subject.account = block.target_account - - expect(subject.permitted?(block.account)).to be false - end - end - describe '#ancestors' do let!(:alice) { Fabricate(:account, username: 'alice') } let!(:bob) { Fabricate(:account, username: 'bob', domain: 'example.com') } |