queue_factory_spec.rb 899 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'lib/import/factory_examples'
  4. RSpec.describe Import::OTRS::QueueFactory do
  5. it_behaves_like 'Import::Factory'
  6. def load_queue_json(file)
  7. json_fixture("import/otrs/queue/#{file}")
  8. end
  9. context 'when parent and child queues are imported' do
  10. let(:parent_queue) { load_queue_json('default') }
  11. let(:child_queue) { load_queue_json('child') }
  12. it 'sorts queues by name and imports successfully', :aggregate_failures do
  13. expect(described_class.import([child_queue, parent_queue])).to include(
  14. hash_including('Name' => parent_queue['Name']),
  15. hash_including('Name' => child_queue['Name'])
  16. )
  17. expect(Group.find_by(name: parent_queue['Name'])).to be_present
  18. expect(Group.find_by(name: child_queue['Name'])).to be_present
  19. end
  20. end
  21. end