online_notification_policy_spec.rb 577 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. describe OnlineNotificationPolicy do
  4. subject { described_class.new(user, record) }
  5. let(:user) { create(:admin) }
  6. context 'when user is owner' do
  7. let(:record,) { create(:online_notification, user: user) }
  8. it { is_expected.to permit_actions(%i[show destroy update]) }
  9. end
  10. context 'when user is not owner' do
  11. let(:record) { create(:online_notification, user: create(:user)) }
  12. it { is_expected.to forbid_actions(%i[show destroy update]) }
  13. end
  14. end