issue_2345_es_attachment_max_size_in_mb_setting_lower_default_spec.rb 978 B

1234567891011121314151617181920212223242526
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Issue2345EsAttachmentMaxSizeInMbSettingLowerDefault, type: :db_migration do
  4. context 'Issue2345EsAttachmentMaxSizeInMbSettingLowerDefault migration' do
  5. it 'decreases the default value' do
  6. allow(Setting).to receive(:get).with('es_attachment_max_size_in_mb').and_return(50)
  7. migrate
  8. # reset/remove mocks
  9. RSpec::Mocks.space.proxy_for(Setting).reset
  10. expect(Setting.get('es_attachment_max_size_in_mb')).not_to be(50)
  11. end
  12. it 'preserves custom Setting value' do
  13. allow(Setting).to receive(:get).with('es_attachment_max_size_in_mb').and_return(5)
  14. expect { migrate }.not_to change { Setting.get('es_attachment_max_size_in_mb') }
  15. end
  16. it 'performs no action for new systems', system_init_done: false do
  17. expect { migrate }.not_to change { Setting.get('es_attachment_max_size_in_mb') }
  18. end
  19. end
  20. end