add_object_attribute_relation_fields_belongs_to_value_spec.rb 694 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe AddObjectAttributeRelationFieldsBelongsToValue, type: :db_migration do
  4. context 'when field does not have belongs_to', db_strategy: :reset do
  5. let(:attribute) { ObjectManager::Attribute.get(name: 'organization_ids', object: 'User') }
  6. before do
  7. attribute.data_option.delete(:belongs_to)
  8. attribute.save!
  9. ObjectManager::Attribute.migration_execute
  10. end
  11. it 'does add belongs_to value inside data option' do
  12. expect { migrate }.to change { attribute.reload.data_option[:belongs_to] }.from(nil).to('secondary_organizations')
  13. end
  14. end
  15. end