priority_factory_spec.rb 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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::PriorityFactory do
  5. it_behaves_like 'Import::Factory'
  6. it 'imports records' do
  7. import_data = {
  8. name: 'test',
  9. }
  10. allow(Import::OTRS::Priority).to receive(:new)
  11. described_class.import([import_data])
  12. expect(Import::OTRS::Priority).to have_received(:new).with(import_data)
  13. end
  14. it 'sets default create Priority' do
  15. priority = Ticket::Priority.first
  16. priority.default_create = false
  17. priority.callback_loop = true
  18. priority.save
  19. allow(Import::OTRS::SysConfigFactory).to receive(:postmaster_default_lookup).with(:priority_default_create).and_return(priority.name)
  20. described_class.update_attribute_settings
  21. priority.reload
  22. expect(priority.default_create).to be true
  23. end
  24. it "doesn't set default create Priority in diff import" do
  25. priority = Ticket::Priority.first
  26. priority.default_create = false
  27. priority.callback_loop = true
  28. priority.save
  29. allow(Import::OTRS).to receive(:diff?).and_return(true)
  30. described_class.update_attribute_settings
  31. priority.reload
  32. expect(priority.default_create).to be false
  33. end
  34. end