mirror of
https://github.com/vagrant-libvirt/vagrant-libvirt.git
synced 2025-02-25 18:55:27 -06:00
Remove need to explicitly set VAGRANT_HOME before running tests (#1580)
Ensure that the tests always set VAGRANT_HOME into the environment to prevent the global plugin manager from trying to load the plugins under this directory.
This commit is contained in:
@@ -38,13 +38,12 @@ rescue LoadError
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
require 'vagrant-libvirt'
|
||||
require 'vagrant-spec/unit'
|
||||
|
||||
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
|
||||
|
||||
RSpec.configure do |config|
|
||||
# set VAGRANT_HOME before any thing that requires vagrant is loaded to prevent
|
||||
# the global plugin manager from trying to use the default VAGRANT_HOME.
|
||||
temp_dir = Dir.mktmpdir("rspec-")
|
||||
ENV['VAGRANT_HOME'] = temp_dir
|
||||
|
||||
# ensure that setting of LIBVIRT_DEFAULT_URI in the environment is not picked
|
||||
# up directly by tests, instead they must set as needed. Some build envs will
|
||||
# may have it set to 'qemu:///session'.
|
||||
@@ -52,6 +51,10 @@ RSpec.configure do |config|
|
||||
ENV.delete('LIBVIRT_DEFAULT_URI')
|
||||
end
|
||||
|
||||
config.after(:suite) do
|
||||
FileUtils.remove_entry temp_dir
|
||||
end
|
||||
|
||||
config.mock_with :rspec do |mocks|
|
||||
mocks.verify_partial_doubles = true
|
||||
end
|
||||
@@ -59,3 +62,7 @@ RSpec.configure do |config|
|
||||
# don't run acceptance tests by default
|
||||
config.filter_run_excluding :acceptance => true
|
||||
end
|
||||
|
||||
require 'vagrant-spec/unit'
|
||||
|
||||
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |f| require f }
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
require 'spec_helper'
|
||||
require 'support/sharedcontext'
|
||||
|
||||
require 'vagrant-libvirt'
|
||||
require 'vagrant-libvirt/plugin'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user