version_policy_spec.rb 630 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. describe VersionPolicy do
  4. subject(:version_policy) { described_class.new(user, nil) }
  5. let(:user) { create(:user, roles: [role]) }
  6. context 'with "admin" privileges' do
  7. let(:role) do
  8. create(:role).tap { |role| role.permission_grant('admin') }
  9. end
  10. it { is_expected.to permit_actions(%i[show]) }
  11. end
  12. context 'without "admin" privileges' do
  13. let(:role) do
  14. create(:role).tap { |role| role.permission_grant('ticket.agent') }
  15. end
  16. it { is_expected.to forbid_actions(%i[show]) }
  17. end
  18. end