issue_2345_es_attachment_max_size_in_mb_setting_lower_default_spec.rb 901 B

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