update_spec.rb 858 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Service::User::CalendarSubscription::Update do
  4. let(:user) { create(:user) }
  5. let(:service) { described_class.new(user, input:) }
  6. let(:input) do
  7. {
  8. alarm: true,
  9. new_open: { own: false, not_assigned: true },
  10. pending: { own: true, not_assigned: true },
  11. escalation: { own: false, not_assigned: false },
  12. }
  13. end
  14. it 'sets alarm and type-specific options' do
  15. service.execute
  16. expect(user.preferences.dig(:calendar_subscriptions, :tickets))
  17. .to include(
  18. alarm: true,
  19. new_open: include(own: false, not_assigned: true),
  20. pending: include(own: true, not_assigned: true),
  21. escalation: include(own: false, not_assigned: false),
  22. )
  23. end
  24. end