2019-07-31 22:56:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
require Rails.root.join('config', 'object_store_settings.rb')
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe ObjectStoreSettings do
|
2018-11-18 11:00:15 +05:30
|
|
|
describe '.parse' do
|
2019-07-07 11:18:12 +05:30
|
|
|
it 'sets correct default values' do
|
2018-11-18 11:00:15 +05:30
|
|
|
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
|