2019-04-15 06:17:05 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-07-23 10:33:06 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
require Rails.root.join('config', 'object_store_settings.rb')
|
|
|
|
|
|
|
|
describe ObjectStoreSettings do
|
|
|
|
describe '.parse' do
|
2019-04-05 04:43:27 -04:00
|
|
|
it 'sets correct default values' do
|
2018-07-23 10:33:06 -04:00
|
|
|
settings = described_class.parse(nil)
|
|
|
|
|
|
|
|
expect(settings['enabled']).to be false
|
|
|
|
expect(settings['direct_upload']).to be false
|
|
|
|
expect(settings['background_upload']).to be true
|
|
|
|
expect(settings['remote_directory']).to be nil
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'respects original values' do
|
|
|
|
original_settings = Settingslogic.new({
|
|
|
|
'enabled' => true,
|
|
|
|
'remote_directory' => 'artifacts'
|
|
|
|
})
|
|
|
|
|
|
|
|
settings = described_class.parse(original_settings)
|
|
|
|
|
|
|
|
expect(settings['enabled']).to be true
|
|
|
|
expect(settings['direct_upload']).to be false
|
|
|
|
expect(settings['background_upload']).to be true
|
|
|
|
expect(settings['remote_directory']).to eq 'artifacts'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|