diff options
Diffstat (limited to 'spec/policies/global_policy_spec.rb')
-rw-r--r-- | spec/policies/global_policy_spec.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/policies/global_policy_spec.rb b/spec/policies/global_policy_spec.rb index df6cc526eb0..880f1bcbc05 100644 --- a/spec/policies/global_policy_spec.rb +++ b/spec/policies/global_policy_spec.rb @@ -141,6 +141,40 @@ describe GlobalPolicy do end end + describe 'receive notifications' do + describe 'regular user' do + it { is_expected.to be_allowed(:receive_notifications) } + end + + describe 'admin' do + let(:current_user) { create(:admin) } + + it { is_expected.to be_allowed(:receive_notifications) } + end + + describe 'anonymous' do + let(:current_user) { nil } + + it { is_expected.not_to be_allowed(:receive_notifications) } + end + + describe 'blocked user' do + before do + current_user.block + end + + it { is_expected.not_to be_allowed(:receive_notifications) } + end + + describe 'deactivated user' do + before do + current_user.deactivate + end + + it { is_expected.not_to be_allowed(:receive_notifications) } + end + end + describe 'git access' do describe 'regular user' do it { is_expected.to be_allowed(:access_git) } @@ -158,6 +192,14 @@ describe GlobalPolicy do it { is_expected.to be_allowed(:access_git) } end + describe 'deactivated user' do + before do + current_user.deactivate + end + + it { is_expected.not_to be_allowed(:access_git) } + end + context 'when terms are enforced' do before do enforce_terms @@ -246,6 +288,14 @@ describe GlobalPolicy do it { is_expected.not_to be_allowed(:use_slash_commands) } end + context 'when deactivated' do + before do + current_user.deactivate + end + + it { is_expected.not_to be_allowed(:use_slash_commands) } + end + context 'when access locked' do before do current_user.lock_access! |