issue_3669_fix_domain_spec.rb 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue3669FixDomain, type: :db_migration do
  4. let!(:channel) do
  5. channel_options = {
  6. inbound: {
  7. adapter: 'imap',
  8. options: {
  9. auth_type: 'XOAUTH2',
  10. host: 'imap.gmail.com',
  11. ssl: true,
  12. user: 'example@gmail.com',
  13. },
  14. },
  15. outbound: {
  16. adapter: 'smtp',
  17. options: {
  18. host: 'smtp.gmail.com',
  19. domain: 'gmail.com',
  20. port: 465,
  21. ssl: true,
  22. user: 'example@gmail.com',
  23. authentication: 'xoauth2',
  24. },
  25. },
  26. auth: {
  27. provider: 'google',
  28. type: 'XOAUTH2',
  29. client_id: 'abc',
  30. client_secret: 'efg',
  31. },
  32. }
  33. Channel.create!(
  34. area: 'Google::Account',
  35. group_id: Group.first.id,
  36. options: channel_options,
  37. active: false,
  38. created_by_id: 1,
  39. updated_by_id: 1,
  40. )
  41. end
  42. it 'removes domain from the configuration' do
  43. expect { migrate }.to change { channel.reload.options[:outbound][:options][:domain] }.to(nil)
  44. end
  45. end