Added test to expect host vars being inserted into inventory.

This commit is contained in:
Christian Henz 2015-12-01 17:04:56 +01:00
parent 78766ded4e
commit a5dd61c450
2 changed files with 16 additions and 0 deletions

View File

@ -30,6 +30,7 @@ describe VagrantPlugins::Ansible::Config::Host do
galaxy_roles_path
groups
host_key_checking
host_vars
inventory_path
limit
playbook
@ -62,6 +63,7 @@ describe VagrantPlugins::Ansible::Config::Host do
expect(subject.tags).to be_nil
expect(subject.skip_tags).to be_nil
expect(subject.start_at_task).to be_nil
expect(subject.host_vars).to eq({})
expect(subject.groups).to eq({})
expect(subject.host_key_checking).to be_false
expect(subject.raw_arguments).to be_nil

View File

@ -234,6 +234,20 @@ VF
end
end
describe "with host_vars option" do
it_should_create_and_use_generated_inventory
it "adds host variables to the generated inventory" do
config.host_vars = {
machine.name => {"http_port" => 80, "maxRequestsPerChild" => 808}
}
expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args|
inventory_content = File.read(generated_inventory_file)
expect(inventory_content).to match("^" + Regexp.quote(machine.name) + ".+http_port=80 maxRequestsPerChild=808")
}
end
end
describe "with groups option" do
it_should_create_and_use_generated_inventory