diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb index 007d3b98a..a8097aa8c 100644 --- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb +++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb @@ -270,6 +270,7 @@ VF before do config.sudo = false config.ask_sudo_pass = false + config.ask_vault_pass = false config.sudo_user = 'root' end @@ -281,6 +282,7 @@ VF expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args| expect(args.index("--sudo")).to be_nil expect(args.index("--ask-sudo-pass")).to be_nil + expect(args.index("--ask-vault-pass")).to be_nil } end end @@ -355,6 +357,34 @@ VF end end + describe "with ask_vault_pass option" do + before do + config.ask_vault_pass = true + end + + it_should_set_arguments_and_environment_variables 6 + + it "should ask the vault password" do + expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args| + expect(args).to include("--ask-vault-pass") + } + end + end + + describe "with vault_password_file option" do + before do + config.vault_password_file = existing_file + end + + it_should_set_arguments_and_environment_variables 6 + + it "uses the given vault password file" do + expect(Vagrant::Util::Subprocess).to receive(:execute).with { |*args| + expect(args).to include("--vault-password-file=#{existing_file}") + } + end + end + describe "with raw_ssh_args" do before do config.raw_ssh_args = ['-o ControlMaster=no']