2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2016-11-25 16:10:37 +00:00
|
|
|
require 'rails_helper'
|
2017-03-27 09:25:45 +00:00
|
|
|
require 'lib/import/helper_examples'
|
2016-11-25 16:10:37 +00:00
|
|
|
|
|
|
|
RSpec.describe Import::Helper do
|
|
|
|
it_behaves_like 'Import::Helper'
|
|
|
|
|
2017-03-27 13:22:07 +00:00
|
|
|
context 'import mode' do
|
|
|
|
|
|
|
|
it 'checks if import_mode is active' do
|
2020-10-22 13:57:01 +00:00
|
|
|
allow(Setting).to receive(:get).with('import_mode').and_return(true)
|
|
|
|
|
2017-03-27 13:22:07 +00:00
|
|
|
expect( described_class.check_import_mode ).to be true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'throws an exception if import_mode is disabled' do
|
2020-10-22 13:57:01 +00:00
|
|
|
allow(Setting).to receive(:get).with('import_mode').and_return(false)
|
|
|
|
|
2017-03-27 13:22:07 +00:00
|
|
|
expect { described_class.check_import_mode }.to raise_error(RuntimeError)
|
|
|
|
end
|
2016-11-25 16:10:37 +00:00
|
|
|
end
|
|
|
|
|
2017-03-27 13:22:07 +00:00
|
|
|
context 'system init' do
|
|
|
|
|
|
|
|
it 'checks if system_init_done is active' do
|
2020-10-22 13:57:01 +00:00
|
|
|
allow(Setting).to receive(:get).with('system_init_done').and_return(false)
|
|
|
|
|
2017-03-27 13:22:07 +00:00
|
|
|
expect( described_class.check_system_init_done ).to be true
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'throws an exception if system_init_done is disabled' do
|
2020-10-22 13:57:01 +00:00
|
|
|
allow(Setting).to receive(:get).with('system_init_done').and_return(true)
|
|
|
|
|
2017-03-27 13:22:07 +00:00
|
|
|
expect { described_class.check_system_init_done }.to raise_error(RuntimeError)
|
|
|
|
end
|
2016-11-25 16:10:37 +00:00
|
|
|
end
|
2017-03-27 13:22:07 +00:00
|
|
|
|
2016-11-25 16:10:37 +00:00
|
|
|
end
|