Charlie Sharpsteen 4144b45122 Fix RDP connections on OS X
Changes introduced in 982af05 caused the RDP configuration file to be written
with all settings on one line instead of one setting per line. The Microsoft
Remote Desktop client for OS X rejects these configuration files as being
malformed. This patch restores the configuration to one line per setting and
adds tests to guard against regression.
2016-08-09 14:04:50 -07:00

37 lines
1.1 KiB
Ruby

require_relative "../../../../base"
require_relative "../../../../../../plugins/hosts/darwin/cap/rdp"
describe VagrantPlugins::HostDarwin::Cap::RDP do
let(:rdp_info) do
{
host: "host",
port: "port",
username: "username",
}
end
it "includes the default options" do
path = described_class.generate_config_file(rdp_info)
result = File.readlines(path).map(&:chomp)
expect(result).to include("drivestoredirect:s:*")
expect(result).to include("full address:s:host:port")
expect(result).to include("prompt for credentials:i:1")
expect(result).to include("username:s:username")
end
it "includes extra RDP arguments" do
rdp_info.merge!(extra_args: ["screen mode id:i:0"])
path = described_class.generate_config_file(rdp_info)
result = File.readlines(path).map(&:chomp)
expect(result).to include("screen mode id:i:0")
end
it "opens the RDP file" do
env = double(:env)
allow(described_class).to receive(:generate_config_file).and_return("/path")
expect(Vagrant::Util::Subprocess).to receive(:execute).with("open", "/path")
described_class.rdp_client(env, rdp_info)
end
end