Sha256: 851a21ab4f3d27acaaa338240aa4dda18e4a36e18a1e65f7e12ba11345df312d

Contents?: true

Size: 1.99 KB

Versions: 14

Compression:

Stored size: 1.99 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', :instance_type => 't1.micro') }.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', :instance_type => 't1.micro', :security_groups => ["testSecurityGroup1", "testSecurityGroup2"] )
      ec2.template.should == {'Resources' => {'name' => {'Type' => 'AWS::EC2::Instance', 'Properties' => {"KeyName" => 'testkey', "ImageId" => 'image_id', "InstanceType" => 't1.micro', "SecurityGroups" => ["testSecurityGroup1", "testSecurityGroup2"]} }}}
    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', :instance_type => 't1.micro', :security_groups => ["testSecurityGroup1"])
      hash.should == {'Resources' => {'name' => {'Type' => 'AWS::EC2::Instance', 'Properties' => {"KeyName" => 'testkey', "ImageId" => 'image_id', "InstanceType" => 't1.micro', "SecurityGroups" => ["testSecurityGroup1"]} }}}
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
cloudster-2.19.1 spec/ec2_spec.rb
cloudster-2.19.0 spec/ec2_spec.rb
cloudster-2.18.0 spec/ec2_spec.rb
cloudster-2.17.0 spec/ec2_spec.rb
cloudster-2.16.0 spec/ec2_spec.rb
cloudster-2.15.0 spec/ec2_spec.rb
cloudster-2.14.1 spec/ec2_spec.rb
cloudster-2.14.0 spec/ec2_spec.rb
cloudster-2.13.1 spec/ec2_spec.rb
cloudster-2.13.0 spec/ec2_spec.rb
cloudster-2.12.0 spec/ec2_spec.rb
cloudster-2.11.0 spec/ec2_spec.rb
cloudster-2.10.0 spec/ec2_spec.rb
cloudster-2.9.0 spec/ec2_spec.rb