issue_2429_user_identifier_validation_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue2429UserIdentifierValidation, type: :db_migration do
  4. let(:elem) { ObjectManager::Attribute.for_object(User).find_by(name: 'firstname') }
  5. it 'resets value directly in screen' do
  6. elem.screens = { screen1: { asd: true, null: false } }
  7. elem.save!
  8. migrate
  9. expect(elem.reload.screens).to eq({ screen1: { asd: true, null: true } }.deep_stringify_keys)
  10. end
  11. it 'resets value nested in permission' do
  12. elem.screens = { screen1: { all: { asd: true, null: false } } }
  13. elem.save!
  14. migrate
  15. expect(elem.reload.screens).to eq({ screen1: { all: { asd: true, null: true } } }.deep_stringify_keys)
  16. end
  17. it 'does not touch when null not present directly in screen' do
  18. elem.screens = { screen1: { all: { asd: true } } }
  19. elem.save!
  20. expect { migrate }.not_to change { elem.reload.updated_at }
  21. end
  22. it 'does not touch when null not present in permission' do
  23. elem.screens = { screen1: { asd: true } }
  24. elem.save!
  25. expect { migrate }.not_to change { elem.reload.updated_at }
  26. end
  27. end