issue4012_missing_rows_for_textarea_fields_spec.rb 850 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue4012MissingRowsForTextareaFields, type: :db_migration do
  4. let(:textarea_with_rows) do
  5. create(:object_manager_attribute_textarea, data_option: { default: 'dummy text', rows: 10, maxlength: 500 })
  6. end
  7. let(:textarea_without_rows) do
  8. object = build(:object_manager_attribute_textarea, data_option: { default: 'dummy text', rows: nil })
  9. object.save(validate: false)
  10. object
  11. end
  12. it 'does not change a valid textarea field' do
  13. expect { migrate }
  14. .not_to change { textarea_with_rows.data_option[:rows] }
  15. end
  16. it 'does change an invalid textarea field and inserts rows information' do
  17. expect { migrate }
  18. .to change { textarea_without_rows.reload.data_option[:rows] }
  19. .to 4
  20. end
  21. end