issue_4086_fix_historical_options_spec.rb 832 B

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue4086FixHistoricalOptions, type: :db_migration do
  4. let(:expected) do
  5. {
  6. 'Sonstiges' => 'Sonstiges',
  7. 'Hardware' => 'Hardware',
  8. 'Software' => 'Software',
  9. }
  10. end
  11. let(:attribute) do
  12. attribute = create(:object_manager_attribute_select)
  13. attribute.data_option[:historical_options] = [
  14. { 'name' => 'Sonstiges', 'value' => 'Sonstiges' },
  15. { 'name' => 'Hardware', 'value' => 'Hardware' },
  16. { 'name' => 'Software', 'value' => 'Software' }
  17. ]
  18. attribute.save
  19. attribute
  20. end
  21. before do
  22. attribute
  23. end
  24. it 'does fix the broken historical_options' do
  25. migrate
  26. expect(attribute.reload.data_option[:historical_options]).to eq(expected)
  27. end
  28. end