helper_spec.rb 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. require 'lib/import/helper_examples'
  4. RSpec.describe Import::Helper do
  5. it_behaves_like 'Import::Helper'
  6. context 'import mode' do
  7. it 'checks if import_mode is active' do
  8. allow(Setting).to receive(:get).with('import_mode').and_return(true)
  9. expect(described_class.check_import_mode).to be true
  10. end
  11. it 'throws an exception if import_mode is disabled' do
  12. allow(Setting).to receive(:get).with('import_mode').and_return(false)
  13. expect { described_class.check_import_mode }.to raise_error(RuntimeError)
  14. end
  15. end
  16. context 'system init' do
  17. it 'checks if system_init_done is active' do
  18. allow(Setting).to receive(:get).with('system_init_done').and_return(false)
  19. expect(described_class.check_system_init_done).to be true
  20. end
  21. it 'throws an exception if system_init_done is disabled' do
  22. allow(Setting).to receive(:get).with('system_init_done').and_return(true)
  23. expect { described_class.check_system_init_done }.to raise_error(RuntimeError)
  24. end
  25. end
  26. end