Sha256: b33fee790a4d5cc4b4d6af312778691f4fb13d1cb08ce904fe41e348d75aa234

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe Ridley::HostConnector::WinRM do
  let(:resource) { double('resource') }

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

  let(:node_two) do
    Ridley::NodeObject.new(resource, automatic: { cloud: { public_hostname: "33.33.33.11" } })
  end
  let(:command_uploader) { double('command_uploader', cleanup: nil) }

  before do
    Ridley::HostConnector::WinRM::CommandUploader.stub(:new).and_return(command_uploader)
  end

  describe "ClassMethods" do
    subject { Ridley::HostConnector::WinRM }

    describe "::start" do
      let(:options) do
        {
          user: "Administrator",
          password: "password1"
        }
      end

      it "evaluates within the context of a new WinRM and returns the last item in the block" do
        result = subject.start([node_one, node_two], options) do |winrm|
          winrm.run("dir")
        end
        result.should be_a(Ridley::HostConnector::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::HostConnector::WinRM.new([node_one, node_two], user: 'Administrator', password: 'password1') }

  describe "#run" do
    it "returns a ResponseSet" do
      subject.run("dir").should be_a(Ridley::HostConnector::ResponseSet)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ridley-0.12.4 spec/unit/ridley/host_connector/winrm_spec.rb
ridley-0.12.3 spec/unit/ridley/host_connector/winrm_spec.rb
ridley-0.12.2 spec/unit/ridley/host_connector/winrm_spec.rb
ridley-0.12.1 spec/unit/ridley/host_connector/winrm_spec.rb
ridley-0.12.0 spec/unit/ridley/host_connector/winrm_spec.rb
ridley-0.11.2 spec/unit/ridley/host_connector/winrm_spec.rb
ridley-0.12.0.rc1 spec/unit/ridley/host_connector/winrm_spec.rb
ridley-0.11.1 spec/unit/ridley/host_connector/winrm_spec.rb
ridley-0.11.0.rc1 spec/unit/ridley/host_connector/winrm_spec.rb