dynamic_field_factory_spec.rb 856 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'lib/import/factory_examples'
  4. require 'lib/import/otrs/dynamic_field_examples'
  5. RSpec.describe Import::OTRS::DynamicFieldFactory do
  6. let(:object_structure) { [load_dynamic_field_json('text/default')] }
  7. let(:start_import_test) { described_class.import(object_structure) }
  8. it_behaves_like 'Import::Factory'
  9. it 'responds to skip_field?' do
  10. expect(described_class).to respond_to('skip_field?')
  11. end
  12. it 'skips fields that have unsupported types' do
  13. described_class.import([load_dynamic_field_json('unsupported/master_slave')])
  14. expect(described_class.skip_field?('MasterSlave')).to be true
  15. end
  16. it 'imports OTRS DynamicFields' do
  17. expect(Import::OTRS::DynamicField::Text).to receive(:new)
  18. start_import_test
  19. end
  20. end