Sha256: 2fba921e875edd0d45eda1ba0fdc0907ba9abbb466683b4ad0a2b97daad28251

Contents?: true

Size: 1.11 KB

Versions: 11

Compression:

Stored size: 1.11 KB

Contents

require "spec_helper"
require "opsicle"

module Opsicle
  describe ListInstances do
    subject { ListInstances.new('derp') }

    context "#execute" do
      let(:client) { double }
      let(:layers) { [ { layer_id: 1, name: "Layer 1" }, { layer_id: 2, name: "Layer 2" }] }
      let(:instances) { [
          { hostname: 'test', layer_ids: [1], status: 'online', instance_id: 'opsworks-instance-id'},
          { hostname: 'test2', layer_ids: [2], status: 'online', instance_id: 'opsworks-instance-id2'},
        ] }
      before do
        allow(Client).to receive(:new).with('derp').and_return(client)
      end

      it "shows a table with all of the instances for the stack from OpsWorks" do
        expect(subject).to receive(:get_layers).and_return(layers)
        expect(subject).to receive(:get_instances).and_return(instances)
        expect(subject).to receive(:print).with(instances)
        subject.execute
      end
    end

    context "#client" do
      it "generates a new aws client from the given configs" do
        expect(Client).to receive(:new).with('derp')
        subject.client
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
opsicle-0.11.0 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.10.0 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.9.0 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.8.2 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.8.1 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.8.0 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.7.1 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.7.0 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.6.0 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.5.1 spec/opsicle/commands/list_instances_spec.rb
opsicle-0.5.0 spec/opsicle/commands/list_instances_spec.rb