1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
From: Antonio Terceiro <terceiro@debian.org>
Date: Sun, 7 Feb 2021 15:35:35 -0300
Subject: tests: fix tests to work against installed package
---
test/unit/plugins/commands/init/command_test.rb | 8 +++++---
test/unit/plugins/hosts/linux/cap/nfs_test.rb | 2 +-
test/unit/plugins/hosts/void/cap/nfs_test.rb | 2 +-
test/unit/plugins/providers/virtualbox/synced_folder_test.rb | 2 +-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/test/unit/plugins/commands/init/command_test.rb b/test/unit/plugins/commands/init/command_test.rb
index 6bb86fa..6319a81 100644
--- a/test/unit/plugins/commands/init/command_test.rb
+++ b/test/unit/plugins/commands/init/command_test.rb
@@ -1,6 +1,8 @@
require_relative "../../../base"
require_relative "../../../../../plugins/commands/init/command"
+tests_root = Pathname(__FILE__).join("../../../../../..")
+
describe VagrantPlugins::CommandInit::Command do
include_context "unit"
include_context "command plugin helpers"
@@ -43,13 +45,13 @@ describe VagrantPlugins::CommandInit::Command do
end
it "creates a custom Vagrantfile using an absolute template path" do
- described_class.new(["--template", ::Vagrant.source_root.join("test/unit/templates/commands/init/Vagrantfile").to_s], env).execute
+ described_class.new(["--template", tests_root.join("test/unit/templates/commands/init/Vagrantfile").to_s], env).execute
contents = File.read(vagrantfile_path)
expect(contents).to match(/config.vm.hostname = "vagrant.dev"/)
end
it "creates a custom Vagrantfile using a provided template with the extension included" do
- described_class.new(["--template", ::Vagrant.source_root.join("test/unit/templates/commands/init/Vagrantfile.erb").to_s], env).execute
+ described_class.new(["--template", tests_root.join("test/unit/templates/commands/init/Vagrantfile.erb").to_s], env).execute
contents = File.read(vagrantfile_path)
expect(contents).to match(/config.vm.hostname = "vagrant.dev"/)
end
@@ -71,7 +73,7 @@ describe VagrantPlugins::CommandInit::Command do
end
it "ignores the -m option when using a provided template" do
- described_class.new(["-m", "--template", ::Vagrant.source_root.join("test/unit/templates/commands/init/Vagrantfile").to_s], env).execute
+ described_class.new(["-m", "--template", tests_root.join("test/unit/templates/commands/init/Vagrantfile").to_s], env).execute
contents = File.read(vagrantfile_path)
expect(contents).to match(/config.vm.hostname = "vagrant.dev"/)
end
diff --git a/test/unit/plugins/hosts/linux/cap/nfs_test.rb b/test/unit/plugins/hosts/linux/cap/nfs_test.rb
index 849ffe9..de8bc36 100644
--- a/test/unit/plugins/hosts/linux/cap/nfs_test.rb
+++ b/test/unit/plugins/hosts/linux/cap/nfs_test.rb
@@ -1,6 +1,6 @@
require_relative "../../../../base"
require_relative "../../../../../../plugins/hosts/linux/cap/nfs"
-require_relative "../../../../../../lib/vagrant/util"
+require "vagrant/util"
describe VagrantPlugins::HostLinux::Cap::NFS do
diff --git a/test/unit/plugins/hosts/void/cap/nfs_test.rb b/test/unit/plugins/hosts/void/cap/nfs_test.rb
index d1f6f00..c0bce7c 100644
--- a/test/unit/plugins/hosts/void/cap/nfs_test.rb
+++ b/test/unit/plugins/hosts/void/cap/nfs_test.rb
@@ -1,6 +1,6 @@
require_relative "../../../../base"
require_relative "../../../../../../plugins/hosts/void/cap/nfs"
-require_relative "../../../../../../lib/vagrant/util"
+require "vagrant/util"
describe VagrantPlugins::HostVoid::Cap::NFS do
diff --git a/test/unit/plugins/providers/virtualbox/synced_folder_test.rb b/test/unit/plugins/providers/virtualbox/synced_folder_test.rb
index 2e9b159..57b68a9 100644
--- a/test/unit/plugins/providers/virtualbox/synced_folder_test.rb
+++ b/test/unit/plugins/providers/virtualbox/synced_folder_test.rb
@@ -1,5 +1,5 @@
require "vagrant"
-require Vagrant.source_root.join("test/unit/base")
+require_relative "../../../base"
require Vagrant.source_root.join("plugins/providers/virtualbox/config")
require Vagrant.source_root.join("plugins/providers/virtualbox/synced_folder")
|