overview_sorting_policy_spec.rb 720 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. describe User::OverviewSortingPolicy do
  4. subject { described_class.new(user1, record) }
  5. let(:user1) { create(:user) }
  6. let(:user2) { create(:user) }
  7. let(:record1) { create(:'user/overview_sorting', user: user1) }
  8. let(:record2) { create(:'user/overview_sorting', user: user2) }
  9. context 'with access to the record' do
  10. let(:record) { record1 }
  11. it { is_expected.to permit_actions(%i[show create update destroy]) }
  12. end
  13. context 'with no access to the record' do
  14. let(:record) { record2 }
  15. it { is_expected.to forbid_actions(%i[show create update destroy]) }
  16. end
  17. end