Sha256: 20957aba677e4b3e76188efa1a8ba95dd4e02b2e70b85938a834b5e06f460d8e

Contents?: true

Size: 1.62 KB

Versions: 5

Compression:

Stored size: 1.62 KB

Contents

require 'spec_helper'

describe Cloudster::Ec2 do
  describe 'initialize' do
    it "should raise argument error if name is not provided" do
      expect { Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id') }.to raise_error(ArgumentError, 'Missing required argument: name')
    end
    it "should raise argument error if no argument is not provided" do
      expect { Cloudster::Ec2.new() }.to raise_error(ArgumentError, 'Missing required argument: name,key_name,image_id')
    end
    it "should not raise argument error if all arguments are provided" do
      expect { Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name: 'name') }.to_not raise_error
    end
  end
  describe '#template' do
    it "should return a ruby hash for the resource cloudformation template" do
      ec2 = Cloudster::Ec2.new(:key_name => 'testkey', :image_id => 'image_id', name: 'name')
      ec2.template.should == {'Resources' => {'name' => {'Type' => 'AWS::EC2::Instance', 'Properties' => {"KeyName" => 'testkey', "ImageId" => 'image_id'} }}}
    end
  end
  describe '.template' do
    it "should raise argument error if no argument is not provided" do
      expect { Cloudster::Ec2.template() }.to raise_error(ArgumentError, 'Missing required argument: name,key_name,image_id')
    end
    it "should return a ruby hash for the resource cloudformation template" do
      hash = Cloudster::Ec2.template(:key_name => 'testkey', :image_id => 'image_id', name: 'name')
      hash.should == {'Resources' => {'name' => {'Type' => 'AWS::EC2::Instance', 'Properties' => {"KeyName" => 'testkey', "ImageId" => 'image_id'} }}}
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cloudster-2.0.0 spec/ec2_spec.rb
cloudster-1.0.0 spec/ec2_spec.rb
cloudster-0.0.2 spec/ec2_spec.rb
cloudster-0.0.1 spec/ec2_spec.rb
cloudster-0.0.0 spec/ec2_spec.rb