Sha256: 059ae2dba03b701d01a3ff19930a01c93805f0863e6f28236655c84eb98be79b

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe Stackster do
  before do
    @logger_stub = stub 'logger stub', :info => 'true', :warn => 'true', :error => 'true'
    @config_stub = stub 'Config', :logger => @logger_stub, :access_key => 'key', :secret_key => 'XXX', :region => 'us-west1'
    @instance_id = 'i-123456'
    @response_stub = stub 'Excon::Response', :body => {
      'reservationSet' => [{
        'instanceSet' => [{'instanceState' => {'name' => 'running'}},
                          {'ipAddress' => '54.10.10.1'},
                          {'instanceId' => 'i-123456'},
                          {'privateIpAddress' => '192.168.1.1'}]}]
    }

    @cf_mock = mock 'CloudFormation'
    Fog::Compute::AWS.stub(:new).and_return(@cf_mock)

    @ec2 = Stackster::AWS::EC2.new(:config => @config_stub)
  end

  describe 'describe_instance' do
    it 'should return the Cloud Formation description of only the running passed instance' do
      @cf_mock.should_receive(:describe_instances).and_return(@response_stub)

      @ec2.describe_instance(@instance_id).should == [{
       'instanceSet' => [{'instanceState' => {'name' => 'running'}},
                         {'ipAddress' => '54.10.10.1'},
                         {'instanceId' => 'i-123456'},
                         {'privateIpAddress' => '192.168.1.1'}]}]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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