2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-12-03 13:09:11 +00:00
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Issue2429UserIdentifierValidation, type: :db_migration do
|
|
|
|
let(:elem) { ObjectManager::Attribute.for_object(User).find_by(name: 'firstname') }
|
|
|
|
|
|
|
|
it 'resets value directly in screen' do
|
|
|
|
elem.screens = { screen1: { asd: true, null: false } }
|
|
|
|
elem.save!
|
|
|
|
|
|
|
|
migrate
|
|
|
|
|
|
|
|
expect(elem.reload.screens).to eq({ screen1: { asd: true, null: true } }.deep_stringify_keys)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'resets value nested in permission' do
|
|
|
|
elem.screens = { screen1: { all: { asd: true, null: false } } }
|
|
|
|
elem.save!
|
|
|
|
|
|
|
|
migrate
|
|
|
|
|
|
|
|
expect(elem.reload.screens).to eq({ screen1: { all: { asd: true, null: true } } }.deep_stringify_keys)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not touch when null not present directly in screen' do
|
|
|
|
elem.screens = { screen1: { all: { asd: true } } }
|
|
|
|
elem.save!
|
|
|
|
|
|
|
|
expect { migrate }.not_to change { elem.reload.updated_at }
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not touch when null not present in permission' do
|
|
|
|
elem.screens = { screen1: { asd: true } }
|
|
|
|
elem.save!
|
|
|
|
|
|
|
|
expect { migrate }.not_to change { elem.reload.updated_at }
|
|
|
|
end
|
|
|
|
end
|