webhooks_spec.rb 967 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe 'Manage > Webhook', type: :system do
  4. context 'when showing the example payload' do
  5. it 'shows correctly' do
  6. visit '/#manage/webhook'
  7. within :active_content do
  8. click 'a[data-type="payload"]'
  9. end
  10. in_modal do
  11. expect(page).to have_text('X-Zammad-Trigger:')
  12. end
  13. end
  14. end
  15. context 'when deleting' do
  16. let!(:webhook) { create(:webhook) }
  17. let!(:trigger) { create(:trigger, perform: { 'notification.webhook' => { 'webhook_id' => webhook.id.to_s } }) }
  18. it 'referenced webhook shows error message' do
  19. visit '/#manage/webhook'
  20. within :active_content do
  21. click '.js-action'
  22. click '.js-delete'
  23. end
  24. in_modal do
  25. click '.js-submit'
  26. expect(page).to have_text('Cannot delete').and(have_text("##{trigger.id}"))
  27. end
  28. end
  29. end
  30. end