Added symlink check to load_config.
This commit is contained in:
@@ -137,7 +137,11 @@ class Browser
|
|||||||
def load_config(config_file = nil)
|
def load_config(config_file = nil)
|
||||||
@config_file = config_file || @config_file
|
@config_file = config_file || @config_file
|
||||||
|
|
||||||
data = JSON.parse(File.read(@config_file))
|
if File.symlink?(@config_file)
|
||||||
|
raise "[ERROR] #{config_file} is a symlink."
|
||||||
|
else
|
||||||
|
data = JSON.parse(File.read(@config_file))
|
||||||
|
end
|
||||||
|
|
||||||
ACCESSOR_OPTIONS.each do |option|
|
ACCESSOR_OPTIONS.each do |option|
|
||||||
option_name = option.to_s
|
option_name = option.to_s
|
||||||
|
|||||||
@@ -200,7 +200,14 @@ describe Browser do
|
|||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
describe '#load_config' do
|
describe '#load_config' do
|
||||||
|
it 'should raise an error if file is a symlink' do
|
||||||
|
symlink = './rspec_symlink'
|
||||||
|
browser = Browser.instance
|
||||||
|
|
||||||
|
File.symlink('./testfile', symlink)
|
||||||
|
expect { browser.load_config(symlink) }.to raise_error
|
||||||
|
File.unlink(symlink)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#merge_request_params without proxy' do
|
describe '#merge_request_params without proxy' do
|
||||||
|
|||||||
Reference in New Issue
Block a user