issue_3617_user_image_source_fix_spec.rb 787 B

12345678910111213141516171819202122232425262728293031
  1. # Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue3617UserImageSourceFix, type: :db_migration, db_strategy: :reset do
  4. describe 'when invalid user' do
  5. let!(:user) do
  6. user = create(:user)
  7. user.update_column(:image_source, 'invalid stuff!!!')
  8. user
  9. end
  10. it 'removes invalid image sources' do
  11. migrate
  12. expect(user.reload.image_source).to eq(nil)
  13. end
  14. end
  15. describe 'when valid user' do
  16. let!(:user) do
  17. user = create(:user)
  18. user.update_column(:image_source, 'https://zammad.org/avatar.png')
  19. user
  20. end
  21. it 'does not change anything' do
  22. migrate
  23. expect(user.reload.image_source).to eq('https://zammad.org/avatar.png')
  24. end
  25. end
  26. end