Sha256: bd02dfab0d4cb4da7282bf9c90c12b2dca9aed45015563d56b828d818b17573e

Contents?: true

Size: 1.99 KB

Versions: 8

Compression:

Stored size: 1.99 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'

describe 'Fog::AWS::EC2::SecurityGroups' do

  describe "#all" do

    it "should return a Fog::AWS::EC2::SecurityGroups" do
      ec2.security_groups.all.should be_a(Fog::AWS::EC2::SecurityGroups)
    end

    it "should include persisted security_groups" do
      security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
      ec2.security_groups.get(security_group.name).should_not be_nil
      security_group.destroy
    end

  end

  describe "#create" do

    before(:each) do
      @security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
    end

    after(:each) do
      @security_group.destroy
    end

    it "should return a Fog::AWS::EC2::SecurityGroup" do
      @security_group.should be_a(Fog::AWS::EC2::SecurityGroup)
    end

    it "should exist on ec2" do
      ec2.security_groups.get(@security_group.name).should_not be_nil
    end

  end

  describe "#get" do

    it "should return a Fog::AWS::EC2::SecurityGroup if a matching security_group exists" do
      security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
      get = ec2.security_groups.get(security_group.name)
      security_group.attributes[:fingerprint].should == get.attributes[:fingerprint]
      security_group.attributes[:name].should == get.attributes[:name]
      security_group.destroy
    end

    it "should return nil if no matching security_group exists" do
      ec2.security_groups.get('notasecuritygroupname').should be_nil
    end

  end

  describe "#new" do

    it "should return a Fog::AWS::EC2::SecurityGroup" do
      ec2.security_groups.new(:description => 'groupdescription', :name => 'keyname').should be_a(Fog::AWS::EC2::SecurityGroup)
    end

  end

  describe "#reload" do

    it "should return a Fog::AWS::EC2::SecurityGroups" do
      ec2.security_groups.all.reload.should be_a(Fog::AWS::EC2::SecurityGroups)
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.0.40 spec/aws/models/ec2/security_groups_spec.rb
fog-0.0.39 spec/aws/models/ec2/security_groups_spec.rb
fog-0.0.38 spec/aws/models/ec2/security_groups_spec.rb
fog-0.0.37 spec/aws/models/ec2/security_groups_spec.rb
fog-0.0.36 spec/aws/models/ec2/security_groups_spec.rb
fog-0.0.35 spec/aws/models/ec2/security_groups_spec.rb
fog-0.0.34 spec/aws/models/ec2/security_groups_spec.rb
fog-0.0.33 spec/aws/models/ec2/security_groups_spec.rb