team_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Sequencer::Sequence::Import::Kayako::Team, sequencer: :sequence do
  4. context 'when importing teams from Kayako' do
  5. let(:resource) do
  6. {
  7. 'id' => 80_000_374_715,
  8. 'legacy_id' => nil,
  9. 'title' => 'Support',
  10. 'businesshour' => {
  11. 'id' => 1,
  12. 'resource_type' => 'business_hour'
  13. },
  14. 'member_count' => 0,
  15. 'created_at' => '2021-08-16T13:42:26+00:00',
  16. 'updated_at' => '2021-08-16T13:42:26+00:00',
  17. 'resource_type' => 'team',
  18. }
  19. end
  20. let(:process_payload) do
  21. {
  22. import_job: build_stubbed(:import_job, name: 'Import::Kayako', payload: {}),
  23. dry_run: false,
  24. resource: resource,
  25. field_map: {},
  26. id_map: {},
  27. }
  28. end
  29. it 'adds groups' do
  30. expect { process(process_payload) }.to change(Group, :count).by(1)
  31. end
  32. it 'check added group data' do
  33. process(process_payload)
  34. expect(Group.last).to have_attributes(
  35. name: 'Support',
  36. active: true,
  37. )
  38. end
  39. end
  40. end