require 'spec_helper'
require 'silver_lining'
require 'silver_lining/connector_example'

describe SilverLining::Command::CommandSsh do

  include_context "behaves like Connector"

  subject do
    SilverLining::Command::CommandSsh.new("an org name", "vapp name", "machine2")
  end

  context "ssh" do
    it "connects with space usernane" do
      expect( subject ).to receive(:exec).with("ssh IP_ADDRESS")

      subject.command("", "IP_ADDRESS")
    end

    it "connects with nil username" do
      expect( subject ).to receive(:exec).with("ssh IP_ADDRESS")

      subject.command(nil, "IP_ADDRESS")
    end

    it "connects with user" do
      expect( subject ).to receive(:exec).with("ssh USERNAME@IP_ADDRESS")

      subject.command("USERNAME", "IP_ADDRESS")
    end
  end
end
