user_field_spec.rb 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'zendesk_api'
  4. RSpec.describe Sequencer::Sequence::Import::Zendesk::UserField, sequencer: :sequence do
  5. context 'when trying to import user fields from Zendesk', db_strategy: :reset do
  6. let(:process_payload) do
  7. {
  8. import_job: build_stubbed(:import_job, name: 'Import::Zendesk', payload: {}),
  9. dry_run: false,
  10. resource: resource,
  11. field_map: {},
  12. }
  13. end
  14. let(:resource) do
  15. ZendeskAPI::UserField.new(
  16. nil,
  17. {
  18. 'id' => 206_315,
  19. 'type' => 'text',
  20. 'key' => 'lieblingstier',
  21. 'title' => 'Lieblingstier',
  22. 'description' => "Hund,
  23. Katze oder Maus?",
  24. 'raw_title' => 'Lieblingstier',
  25. 'raw_description' => "Hund,
  26. Katze oder Maus?",
  27. 'position' => 0,
  28. 'active' => true,
  29. 'system' => false,
  30. 'regexp_for_validation' => nil,
  31. 'created_at' => '2015-12-04 11:05:45 UTC',
  32. 'updated_at' => '2015-12-04 11:05:45 UTC'
  33. }
  34. )
  35. end
  36. it 'adds user fields' do
  37. expect { process(process_payload) }.to change(User, :column_names).by(['lieblingstier'])
  38. end
  39. end
  40. end