issue_4089_fix_draft_attribute_spec.rb 808 B

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue4089FixDraftAttribute, type: :db_migration do
  4. def field
  5. ObjectManager::Attribute.find_by(name: 'shared_drafts', object_lookup_id: ObjectLookup.by_name('Group'))
  6. end
  7. context 'when field does not exist', db_strategy: :reset do
  8. before do
  9. field.destroy
  10. ObjectManager::Attribute.migration_execute
  11. migrate
  12. end
  13. it 'does create the field and set it not editable' do
  14. expect(field.reload.editable).to be(false)
  15. end
  16. end
  17. context 'when field does exist' do
  18. before do
  19. field.update(editable: true)
  20. migrate
  21. end
  22. it 'does set the field to not editable' do
  23. expect(field.reload.editable).to be(false)
  24. end
  25. end
  26. end