Sha256: e7c4977532d5cae2ed475a45ce24794ac040426a959de47fdafbf40372cd035e

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'

describe Stackster do
  before do
    @config_stub = stub 'Config', :access_key => 'key',
                                  :secret_key => 'XXX',
                                  :region => 'us-west1'
    instances = ['first',{ 'Instances' => [{ 'InstanceId' => 'i-000001' },
                                           { 'InstanceId' => 'i-000002' }] }]
    body =  { 'DescribeAutoScalingGroupsResult' => { 'AutoScalingGroups' => instances } }
    @response_stub = stub 'Fog::Response', :body => body
    @auto_scaling_mock = mock 'AutoScalingGroups'
    Fog::AWS::AutoScaling.stub :new => @auto_scaling_mock
    @auto_scaling_groups = Stackster::AWS::AutoScalingGroups.new(:config => @config_stub,
                                                                 :asg_id => 'asg_name')
  end

  describe 'list_instances' do
    it "should return the array of instance id's when passed the AutoScaleGroup name" do
      @auto_scaling_mock.should_receive(:describe_auto_scaling_groups).
                         with('AutoScalingGroupNames' => ['asg_name']).
                         and_return(@response_stub)

      @auto_scaling_groups.list_instances.should ==  ['i-000001','i-000002' ]


    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stackster-0.4.4 spec/aws/auto_scaling_groups_spec.rb
stackster-0.4.3 spec/aws/auto_scaling_groups_spec.rb