From 327bb9ec7db817ead4827a9af27a4cae00e9ddc3 Mon Sep 17 00:00:00 2001 From: Vivek Singh <vivek.singh@msystechnologies.com> Date: Thu, 9 Jul 2020 11:30:00 +0530 Subject: Fix test cases Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com> --- spec/unit/knife/bootstrap_spec.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'spec') diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index f19f28cdb2..dc3241436d 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -1864,9 +1864,8 @@ describe Chef::Knife::Bootstrap do question_mock = double("question") expect(knife).to receive(:do_connect).and_raise(expected_error_password_prompt) expect(knife.ui).to receive(:warn).with(/Failed to auth.*/) - expect(knife.ui).to receive(:ask).and_yield(question_mock).and_return("newpassword") + expect(knife.ui).to receive(:ask).and_return("newpassword") # Ensure that we set echo off to prevent showing password on the screen - expect(question_mock).to receive(:echo=).with false expect(knife).to receive(:do_connect) do |opts| expect(opts[:password]).to eq "newpassword" end @@ -1878,12 +1877,10 @@ describe Chef::Knife::Bootstrap do let(:connection_protocol) { "winrm" } it "warns, prompts for password, then reconnects with a password-enabled configuration using the new password for" do - question_mock = double("question") expect(knife).to receive(:do_connect).and_raise(expected_error_password_prompt_winrm) expect(knife.ui).to receive(:warn).with(/Failed to auth.*/) - expect(knife.ui).to receive(:ask).and_yield(question_mock).and_return("newpassword") + expect(knife.ui).to receive(:ask).and_return("newpassword") # Ensure that we set echo off to prevent showing password on the screen - expect(question_mock).to receive(:echo=).with false expect(knife).to receive(:do_connect) do |opts| expect(opts[:password]).to eq "newpassword" end -- cgit v1.2.1