pgp_controller_policy_spec.rb 887 B

123456789101112131415161718192021222324252627282930
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. describe Controllers::Integration::PGPControllerPolicy do
  4. subject { described_class.new(user, record) }
  5. let(:record_class) { Integration::PGPController }
  6. let(:record) { record_class.new }
  7. context 'when admin' do
  8. let(:user) { create(:admin) }
  9. it { is_expected.to permit_actions(%i[key_list key_show key_download key_add key_delete status search]) }
  10. end
  11. context 'when agent' do
  12. let(:user) { create(:agent) }
  13. it { is_expected.to permit_actions(%i[search]) }
  14. it { is_expected.to forbid_actions(%i[key_list key_show key_download key_add key_delete status]) }
  15. end
  16. context 'when customer' do
  17. let(:user) { create(:customer) }
  18. it { is_expected.to forbid_actions(%i[key_list key_show key_download key_add key_delete status search]) }
  19. end
  20. end