pgp_key_policy_spec.rb 621 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. describe PGPKeyPolicy do
  4. subject(:policy) { described_class.new(user, nil) }
  5. context 'when user is admin' do
  6. let(:user) { create(:admin) }
  7. it { is_expected.to permit_actions(%i[create show destroy]) }
  8. end
  9. context 'when user is an agent' do
  10. let(:user) { create(:agent) }
  11. it { is_expected.to forbid_actions(%i[create show destroy]) }
  12. end
  13. context 'when user is a customer' do
  14. let(:user) { create(:customer) }
  15. it { is_expected.to forbid_actions(%i[create show destroy]) }
  16. end
  17. end