Add test coverage of local rgloader creation

This commit is contained in:
Chris Roberts 2018-10-10 10:30:30 -07:00
parent 006cea45e3
commit 1c480880f1
2 changed files with 18 additions and 1 deletions

View File

@ -910,7 +910,7 @@ module Vagrant
loader_file = @local_data_path.join("rgloader", "loader.rb")
if !loader_file.file?
source_loader = Vagrant.source_root.join("templates/rgloader.rb")
FileUtils.mkdir_p(@local_data_path.join("rgloader"))
FileUtils.mkdir_p(@local_data_path.join("rgloader").to_s)
FileUtils.cp(source_loader.to_s, loader_file.to_s)
end
rescue Errno::EACCES

View File

@ -1513,4 +1513,21 @@ VF
end
end
end
describe "#setup_local_data_path" do
before do
allow(FileUtils).to receive(:mkdir_p).and_call_original
allow(FileUtils).to receive(:cp).and_call_original
end
it "should create an rgloader path" do
expect(FileUtils).to receive(:mkdir_p).with(/(?!home)rgloader/)
instance
end
it "should write the rgloader file" do
expect(FileUtils).to receive(:cp).with(anything, /(?!home)rgloader.*rb$/)
instance
end
end
end