create_spec.rb 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. require 'rails_helper'
  2. RSpec.describe 'Ticket Create', type: :system do
  3. context 'when applying ticket templates' do
  4. # Regression test for issue #2424 - Unavailable ticket template attributes get applied
  5. scenario 'unavailable attributes do not get applied', authenticated: false do
  6. # create a new agent with permissions for only group "some group1"
  7. user = create :agent_user
  8. user.group_names_access_map = {
  9. 'some group1' => 'full',
  10. }
  11. # create a template that sets the group to Users and ticket owner to user id 1
  12. template = create :template, options: {
  13. 'title' => 'Template Title',
  14. 'group_id' => '1',
  15. 'owner_id' => '2',
  16. }
  17. # apply the ticket template and confirm that the group_id dropdown does not appear
  18. login(
  19. username: user.email,
  20. password: 'test',
  21. )
  22. visit 'ticket/create'
  23. find('#form-template select[name="id"]').find(:option, template.name).select_option
  24. click '.sidebar-content .js-apply'
  25. expect(page).not_to have_selector 'select[name="group_id"]'
  26. end
  27. end
  28. end