test/unit/plugins/commands/ssh_config/command_test.rb in vagrant-unbundled-1.8.5.2 vs test/unit/plugins/commands/ssh_config/command_test.rb in vagrant-unbundled-1.9.1.1

- old
+ new

@@ -20,10 +20,12 @@ let(:argv) { [] } let(:ssh_info) {{ host: "testhost.vagrant.dev", port: 1234, username: "testuser", + keys_only: true, + paranoid: false, private_key_path: [], forward_agent: false, forward_x11: false }} @@ -104,8 +106,35 @@ end subject.execute expect(output).to include('IdentityFile "with a space"') + end + + it "omits IdentitiesOnly when keys_only is false" do + allow(machine).to receive(:ssh_info) { ssh_info.merge(keys_only: false) } + + output = "" + allow(subject).to receive(:safe_puts) do |data| + output += data if data + end + + subject.execute + + expect(output).not_to include('IdentitiesOnly') + end + + it "omits StrictHostKeyChecking and UserKnownHostsFile when paranoid is true" do + allow(machine).to receive(:ssh_info) { ssh_info.merge(paranoid: true) } + + output = "" + allow(subject).to receive(:safe_puts) do |data| + output += data if data + end + + subject.execute + + expect(output).not_to include('StrictHostKeyChecking ') + expect(output).not_to include('UserKnownHostsFile ') end end end