notifications_spec.rb 932 B

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'models/form_updater/concerns/checks_core_workflow_examples'
  4. RSpec.describe FormUpdater::Updater::User::Notifications do
  5. subject(:form_updater) do
  6. described_class.new(
  7. context: context,
  8. meta: meta,
  9. data: data,
  10. relation_fields: [],
  11. )
  12. end
  13. let(:user) { create(:user, groups: [group]) }
  14. let(:group) { create(:group) }
  15. let(:context) { { current_user: user } }
  16. let(:meta) { { initial: true, form_id: SecureRandom.uuid } }
  17. let(:data) { {} }
  18. describe '#resolve' do
  19. it 'return user groups' do
  20. expect(form_updater.resolve[:fields]).to include(
  21. 'group_ids' => include(
  22. options: contain_exactly(
  23. include(
  24. value: group.id,
  25. )
  26. )
  27. )
  28. )
  29. end
  30. end
  31. end