Files
vagrant-libvirt/spec/support/sharedcontext.rb
Darragh Bailey 81a35c9f14 Spec test for domain template to verify rendering
Add basic spec tests for the domain template to test rendering through
simple wrapping of a config object to provide values for class instance
variables used by the template as it mostly mirrors those required.
2016-11-25 15:59:44 +00:00

35 lines
1.1 KiB
Ruby

require 'spec_helper'
shared_context "unit" do
include_context 'vagrant-unit'
let(:vagrantfile) do <<-EOF
Vagrant.configure('2') do |config|
config.vm.define :test
end
EOF
end
let(:test_env) do
test_env = isolated_environment
test_env.vagrantfile vagrantfile
test_env
end
let(:env) { { env: iso_env, machine: machine, ui: ui, root_path: '/rootpath' } }
let(:conf) { Vagrant::Config::V2::DummyConfig.new() }
let(:ui) { Vagrant::UI::Basic.new() }
let(:iso_env) { test_env.create_vagrant_env ui_class: Vagrant::UI::Basic }
let(:machine) { iso_env.machine(:test, :libvirt) }
# Mock the communicator to prevent SSH commands for being executed.
let(:communicator) { double('communicator') }
# Mock the guest operating system.
let(:guest) { double('guest') }
let(:app) { lambda { |env| } }
let(:plugin) { register_plugin() }
before (:each) do
machine.stub(:guest => guest)
machine.stub(:communicator => communicator)
end
end