session_helper_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe SessionHelper do
  4. describe 'Core Workflow: Does show wrong field list if you only have admin permissions and not ticket.agent permissions #4035' do
  5. context 'when user has admin.core_workflow permissions' do
  6. let(:core_workflow_role) { create(:role, :admin_core_workflow) }
  7. let(:user) { create(:user, role_ids: [core_workflow_role.id]) }
  8. it 'does provide assets for application selector ui element' do
  9. expect(described_class.json_hash(user)[:collections][ObjectManager::Attribute.to_app_model]).to be_truthy
  10. end
  11. end
  12. context 'when user has ticket.agent permissions' do
  13. let(:user) { create(:agent) }
  14. it 'does provide assets for application selector ui element' do
  15. expect(described_class.json_hash(user)[:collections][ObjectManager::Attribute.to_app_model]).to be_falsey
  16. end
  17. end
  18. context 'when user has customer permissions' do
  19. let(:user) { create(:customer) }
  20. it 'does provide assets for application selector ui element' do
  21. expect(described_class.json_hash(user)[:collections][ObjectManager::Attribute.to_app_model]).to be_falsey
  22. end
  23. end
  24. end
  25. end