Cleanup more files in tests
This commit is contained in:
parent
1b414d3d9e
commit
b993699af6
|
@ -10,13 +10,17 @@ describe VagrantPlugins::DockerProvider::Config do
|
||||||
let(:machine) { double("machine") }
|
let(:machine) { double("machine") }
|
||||||
|
|
||||||
let(:build_dir) do
|
let(:build_dir) do
|
||||||
temporary_dir.tap do |dir|
|
Dir.mktmpdir("vagrant-test-docker-provider-build-dir").tap do |dir|
|
||||||
dir.join("Dockerfile").open("w") do |f|
|
File.open(File.join(dir, "Dockerfile"), "wb+") do |f|
|
||||||
f.write("Hello")
|
f.write("Hello")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
FileUtils.rm_rf(build_dir)
|
||||||
|
end
|
||||||
|
|
||||||
def assert_invalid
|
def assert_invalid
|
||||||
errors = subject.validate(machine)
|
errors = subject.validate(machine)
|
||||||
if !errors.values.any? { |v| !v.empty? }
|
if !errors.values.any? { |v| !v.empty? }
|
||||||
|
|
|
@ -125,6 +125,14 @@ describe VagrantPlugins::AtlasPush::Push do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#uploader_path" do
|
describe "#uploader_path" do
|
||||||
|
let(:scratch) do
|
||||||
|
Pathname.new(Dir.mktmpdir("vagrant-test-atlas-push-upload-path"))
|
||||||
|
end
|
||||||
|
|
||||||
|
after do
|
||||||
|
FileUtils.rm_rf(scratch)
|
||||||
|
end
|
||||||
|
|
||||||
it "should return the configured path if set" do
|
it "should return the configured path if set" do
|
||||||
config.uploader_path = "foo"
|
config.uploader_path = "foo"
|
||||||
expect(subject.uploader_path).to eq("foo")
|
expect(subject.uploader_path).to eq("foo")
|
||||||
|
@ -141,12 +149,10 @@ describe VagrantPlugins::AtlasPush::Push do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should look up the uploader in the embedded dir if installer" do
|
it "should look up the uploader in the embedded dir if installer" do
|
||||||
dir = temporary_dir
|
|
||||||
|
|
||||||
allow(Vagrant).to receive(:in_installer?).and_return(true)
|
allow(Vagrant).to receive(:in_installer?).and_return(true)
|
||||||
allow(Vagrant).to receive(:installer_embedded_dir).and_return(dir.to_s)
|
allow(Vagrant).to receive(:installer_embedded_dir).and_return(scratch.to_s)
|
||||||
|
|
||||||
bin_path = dir.join("bin", bin)
|
bin_path = scratch.join("bin", bin)
|
||||||
bin_path.dirname.mkpath
|
bin_path.dirname.mkpath
|
||||||
bin_path.open("w+") { |f| f.write("hi") }
|
bin_path.open("w+") { |f| f.write("hi") }
|
||||||
|
|
||||||
|
@ -154,10 +160,8 @@ describe VagrantPlugins::AtlasPush::Push do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should look up the uploader in the PATH if not in the installer" do
|
it "should look up the uploader in the PATH if not in the installer" do
|
||||||
dir = temporary_dir
|
|
||||||
|
|
||||||
allow(Vagrant).to receive(:in_installer?).and_return(true)
|
allow(Vagrant).to receive(:in_installer?).and_return(true)
|
||||||
allow(Vagrant).to receive(:installer_embedded_dir).and_return(dir.to_s)
|
allow(Vagrant).to receive(:installer_embedded_dir).and_return(scratch.to_s)
|
||||||
|
|
||||||
expect(Vagrant::Util::Which).to receive(:which).
|
expect(Vagrant::Util::Which).to receive(:which).
|
||||||
with(described_class.const_get(:UPLOADER_BIN)).
|
with(described_class.const_get(:UPLOADER_BIN)).
|
||||||
|
|
|
@ -41,7 +41,7 @@ describe VagrantPlugins::FTPPush::Push do
|
||||||
end
|
end
|
||||||
@server.start
|
@server.start
|
||||||
|
|
||||||
@dir = temporary_dir
|
@dir = Dir.mktmpdir("vagrant-ftp-push")
|
||||||
FileUtils.touch("#{@dir}/.hidden.rb")
|
FileUtils.touch("#{@dir}/.hidden.rb")
|
||||||
FileUtils.touch("#{@dir}/application.rb")
|
FileUtils.touch("#{@dir}/application.rb")
|
||||||
FileUtils.touch("#{@dir}/config.rb")
|
FileUtils.touch("#{@dir}/config.rb")
|
||||||
|
@ -51,6 +51,7 @@ describe VagrantPlugins::FTPPush::Push do
|
||||||
end
|
end
|
||||||
|
|
||||||
after(:all) do
|
after(:all) do
|
||||||
|
FileUtils.rm_rf(@dir)
|
||||||
@server.stop
|
@server.stop
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -290,6 +290,14 @@ describe Vagrant::Box, :skip_windows do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "repackaging" do
|
describe "repackaging" do
|
||||||
|
let(:scratch) { Dir.mktmpdir("vagrant-test-box-repackaging") }
|
||||||
|
|
||||||
|
let(:box_output_path) { File.join(scratch, "package.box") }
|
||||||
|
|
||||||
|
after do
|
||||||
|
FileUtils.rm_rf(scratch)
|
||||||
|
end
|
||||||
|
|
||||||
it "should repackage the box" do
|
it "should repackage the box" do
|
||||||
test_file_contents = "hello, world!"
|
test_file_contents = "hello, world!"
|
||||||
|
|
||||||
|
@ -300,7 +308,6 @@ describe Vagrant::Box, :skip_windows do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Repackage our box to some temporary directory
|
# Repackage our box to some temporary directory
|
||||||
box_output_path = temporary_dir.join("package.box")
|
|
||||||
expect(subject.repackage(box_output_path)).to be_true
|
expect(subject.repackage(box_output_path)).to be_true
|
||||||
|
|
||||||
# Let's now add this box again under a different name, and then
|
# Let's now add this box again under a different name, and then
|
||||||
|
|
|
@ -933,7 +933,7 @@ VF
|
||||||
let(:instance) { described_class.new(local_data_path: local_data_path) }
|
let(:instance) { described_class.new(local_data_path: local_data_path) }
|
||||||
|
|
||||||
after do
|
after do
|
||||||
File.unlink(v1_dotfile) if File.file?(v1_dotfile)
|
FileUtils.rm_rf(local_data_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should be fine if dotfile is empty" do
|
it "should be fine if dotfile is empty" do
|
||||||
|
|
|
@ -9,7 +9,7 @@ require "vagrant/machine_index"
|
||||||
describe Vagrant::MachineIndex do
|
describe Vagrant::MachineIndex do
|
||||||
include_context "unit"
|
include_context "unit"
|
||||||
|
|
||||||
let(:data_dir) { temporary_dir }
|
let(:data_dir) { Pathname.new(Dir.mktmpdir("vagrant-test-machine-index-data-dir")) }
|
||||||
let(:entry_klass) { Vagrant::MachineIndex::Entry }
|
let(:entry_klass) { Vagrant::MachineIndex::Entry }
|
||||||
|
|
||||||
let(:new_entry) do
|
let(:new_entry) do
|
||||||
|
|
Loading…
Reference in New Issue