diff --git a/test/unit/plugins/communicators/winrm/communicator_test.rb b/test/unit/plugins/communicators/winrm/communicator_test.rb index 0a884008b..c3dd52884 100644 --- a/test/unit/plugins/communicators/winrm/communicator_test.rb +++ b/test/unit/plugins/communicators/winrm/communicator_test.rb @@ -12,9 +12,9 @@ describe VagrantPlugins::CommunicatorWinRM::Communicator do let(:shell) { double("shell") } subject do - comm = described_class.new(machine) - allow(comm).to receive(:create_shell).and_return(shell) - comm + described_class.new(machine).tap do |comm| + allow(comm).to receive(:create_shell).and_return(shell) + end end describe ".ready?" do diff --git a/test/unit/plugins/communicators/winrm/shell_test.rb b/test/unit/plugins/communicators/winrm/shell_test.rb index e3ef7a18f..480902df0 100644 --- a/test/unit/plugins/communicators/winrm/shell_test.rb +++ b/test/unit/plugins/communicators/winrm/shell_test.rb @@ -8,9 +8,9 @@ describe VagrantPlugins::CommunicatorWinRM::WinRMShell do let(:session) { double("winrm_session") } subject do - comm = described_class.new('localhost', 'username', 'password') - allow(comm).to receive(:new_session).and_return(session) - comm + described_class.new('localhost', 'username', 'password').tap do |comm| + allow(comm).to receive(:new_session).and_return(session) + end end describe ".powershell" do