diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-11-08 00:28:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-08 00:28:39 +0100 |
commit | 3134691948aeacb16b7386ed77bbea4581beec40 (patch) | |
tree | 45ecf62f19879f08bf4c35584c58a64ea09c0c27 /spec/policies | |
parent | ee8cf246cfe8e05914ad7dcf81596f8535b3e161 (diff) |
Add support for reversible suspensions through ActivityPub (#14989)
Diffstat (limited to 'spec/policies')
-rw-r--r-- | spec/policies/account_policy_spec.rb | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/spec/policies/account_policy_spec.rb b/spec/policies/account_policy_spec.rb index d27e9d5b0..1347ca4a0 100644 --- a/spec/policies/account_policy_spec.rb +++ b/spec/policies/account_policy_spec.rb @@ -7,8 +7,9 @@ RSpec.describe AccountPolicy do let(:subject) { described_class } let(:admin) { Fabricate(:user, admin: true).account } let(:john) { Fabricate(:user).account } + let(:alice) { Fabricate(:user).account } - permissions :index?, :show?, :unsuspend?, :unsensitive?, :unsilence?, :remove_avatar?, :remove_header? do + permissions :index? do context 'staff' do it 'permits' do expect(subject).to permit(admin) @@ -22,6 +23,38 @@ RSpec.describe AccountPolicy do end end + permissions :show?, :unsilence?, :unsensitive?, :remove_avatar?, :remove_header? do + context 'staff' do + it 'permits' do + expect(subject).to permit(admin, alice) + end + end + + context 'not staff' do + it 'denies' do + expect(subject).to_not permit(john, alice) + end + end + end + + permissions :unsuspend? do + before do + alice.suspend! + end + + context 'staff' do + it 'permits' do + expect(subject).to permit(admin, alice) + end + end + + context 'not staff' do + it 'denies' do + expect(subject).to_not permit(john, alice) + end + end + end + permissions :redownload?, :subscribe?, :unsubscribe? do context 'admin' do it 'permits' do |