priority_factory_spec.rb 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. require 'rails_helper'
  2. require 'lib/import/factory_examples'
  3. RSpec.describe Import::OTRS::PriorityFactory do
  4. it_behaves_like 'Import::Factory'
  5. it 'imports records' do
  6. import_data = {
  7. name: 'test',
  8. }
  9. expect(::Import::OTRS::Priority).to receive(:new).with(import_data)
  10. described_class.import([import_data])
  11. end
  12. it 'sets default create Priority' do
  13. priority = ::Ticket::Priority.first
  14. priority.default_create = false
  15. priority.callback_loop = true
  16. priority.save
  17. expect(Import::OTRS::SysConfigFactory).to receive(:postmaster_default_lookup).with(:priority_default_create).and_return(priority.name)
  18. described_class.update_attribute_settings
  19. priority.reload
  20. expect(priority.default_create).to be true
  21. end
  22. it "doesn't set default create Priority in diff import" do
  23. priority = ::Ticket::Priority.first
  24. priority.default_create = false
  25. priority.callback_loop = true
  26. priority.save
  27. expect(Import::OTRS).to receive(:diff?).and_return(true)
  28. described_class.update_attribute_settings
  29. priority.reload
  30. expect(priority.default_create).to be false
  31. end
  32. end