Sha256: ef74c5ceed3614fdcd2aa6b4b282b2a1ebab6a6c6028a2ecbca7c98b5843a1d1

Contents?: true

Size: 1.26 KB

Versions: 12

Compression:

Stored size: 1.26 KB

Contents

require 'spec_helper'

describe Ridley::SSH do
  let(:connection) { double('conn', ssh: { user: "vagrant", password: "vagrant" }) }

  let(:node_one) do
    Ridley::NodeResource.new(connection, automatic: { cloud: { public_hostname: "33.33.33.10" } })
  end

  let(:node_two) do
    Ridley::NodeResource.new(connection, automatic: { cloud: { public_hostname: "33.33.33.11" } })
  end

  describe "ClassMethods" do
    subject { Ridley::SSH }
    
    describe "::start" do
      let(:options) do
        {
          user: "vagrant",
          password: "vagrant"
        }
      end

      it "evaluates within the context of a new SSH and returns the last item in the block" do
        result = subject.start([node_one, node_two], options) do |ssh|
          ssh.run("ls")
        end

        result.should be_a(Ridley::SSH::ResponseSet)
      end

      it "raises a LocalJumpError if a block is not provided" do        
        expect {
          subject.start([node_one, node_two], options)
        }.to raise_error(LocalJumpError)
      end
    end
  end

  subject { Ridley::SSH.new([node_one, node_two], user: "vagrant", password: "vagrant") }

  describe "#run" do
    it "returns an SSH::ResponseSet" do
      subject.run("ls").should be_a(Ridley::SSH::ResponseSet)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ridley-0.9.1 spec/unit/ridley/ssh_spec.rb
ridley-0.9.0 spec/unit/ridley/ssh_spec.rb
ridley-0.8.6 spec/unit/ridley/ssh_spec.rb
ridley-0.8.5 spec/unit/ridley/ssh_spec.rb
ridley-0.8.3 spec/unit/ridley/ssh_spec.rb
ridley-0.8.2 spec/unit/ridley/ssh_spec.rb
ridley-0.8.1 spec/unit/ridley/ssh_spec.rb
ridley-0.8.0 spec/unit/ridley/ssh_spec.rb
ridley-0.7.0 spec/unit/ridley/ssh_spec.rb
ridley-0.7.0.rc4 spec/unit/ridley/ssh_spec.rb
ridley-0.7.0.rc3 spec/unit/ridley/ssh_spec.rb
ridley-0.7.0.rc1 spec/unit/ridley/ssh_spec.rb