group_spec.rb 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Sequencer::Sequence::Import::Freshdesk::Group, sequencer: :sequence do
  4. context 'when importing groups from Freshdesk' do
  5. let(:resource) do
  6. {
  7. 'id' => 80_000_374_715,
  8. 'name' => 'QA',
  9. 'description' => 'Members of the QA team belong to this group',
  10. 'escalate_to' => nil,
  11. 'unassigned_for' => nil,
  12. 'business_hour_id' => nil,
  13. 'group_type' => 'support_agent_group',
  14. 'created_at' => '2021-04-09T13:23:59Z',
  15. 'updated_at' => '2021-04-09T13:23:59Z'
  16. }
  17. end
  18. let(:process_payload) do
  19. {
  20. import_job: build_stubbed(:import_job, name: 'Import::Freshdesk', payload: {}),
  21. dry_run: false,
  22. resource: resource,
  23. field_map: {},
  24. id_map: {},
  25. }
  26. end
  27. it 'adds groups', :aggregate_failures do
  28. expect { process(process_payload) }.to change(Group, :count).by(1)
  29. expect(Group.last).to have_attributes(
  30. name: 'QA',
  31. active: true,
  32. )
  33. end
  34. end
  35. end