overview_scope_spec.rb 788 B

12345678910111213141516171819202122232425262728
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'policies/ticket_policy/shared_examples'
  4. RSpec.describe TicketPolicy::OverviewScope do
  5. context 'with default scope' do
  6. subject(:scope) { described_class.new(user) }
  7. describe '#resolve' do
  8. context 'when querying for agent user' do
  9. include_examples 'for agent user', 'overview'
  10. end
  11. context 'when querying for customer user' do
  12. include_examples 'for customer user'
  13. end
  14. end
  15. end
  16. context 'with predefined, impossible scope' do
  17. subject(:scope) { described_class.new(user, Ticket.where(id: -1)) }
  18. describe '#resolve' do
  19. include_examples 'for agent user with predefined but impossible context'
  20. end
  21. end
  22. end