Sha256: a216542656b9fca4e7674b75c06aa54e4f1f8b7b3836dc49a93ec48e6c1e8be8

Contents?: true

Size: 1.77 KB

Versions: 36

Compression:

Stored size: 1.77 KB

Contents

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

describe 'Fog::AWS::Compute::KeyPairs' do

  describe "#all" do

    it "should return a Fog::AWS::Compute::KeyPairs" do
      AWS[:compute].key_pairs.all.should be_a(Fog::AWS::Compute::KeyPairs)
    end

    it "should include persisted key_pairs" do
      key_pair = AWS[:compute].key_pairs.create(:name => 'keyname')
      AWS[:compute].key_pairs.get(key_pair.name).should_not be_nil
      key_pair.destroy
    end

  end

  describe "#create" do

    before(:each) do
      @key_pair = AWS[:compute].key_pairs.create(:name => 'keyname')
    end

    after(:each) do
      @key_pair.destroy
    end

    it "should return a Fog::AWS::Compute::KeyPair" do
      @key_pair.should be_a(Fog::AWS::Compute::KeyPair)
    end

    it "should exist on ec2" do
      AWS[:compute].key_pairs.get(@key_pair.name).should_not be_nil
    end

  end

  describe "#get" do

    it "should return a Fog::AWS::Compute::KeyPair if a matching key_pair exists" do
      key_pair = AWS[:compute].key_pairs.create(:name => 'keyname')
      get = AWS[:compute].key_pairs.get(key_pair.name)
      key_pair.attributes[:fingerprint].should == get.attributes[:fingerprint]
      key_pair.attributes[:name].should == get.attributes[:name]
      key_pair.destroy
    end

    it "should return nil if no matching key_pair exists" do
      AWS[:compute].key_pairs.get('notakeyname').should be_nil
    end

  end

  describe "#new" do

    it "should return a Fog::AWS::Compute::KeyPair" do
      AWS[:compute].key_pairs.new(:name => 'keyname').should be_a(Fog::AWS::Compute::KeyPair)
    end

  end

  describe "#reload" do

    it "should return a Fog::AWS::Compute::KeyPairs" do
      AWS[:compute].key_pairs.all.reload.should be_a(Fog::AWS::Compute::KeyPairs)
    end

  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
fog-0.4.0 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.34 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.33 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.32 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.31 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.30 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.29 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.28 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.27 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.26 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.25 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.24 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.23 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.22 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.21 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.20 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.19 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.18 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.17 spec/aws/models/compute/key_pairs_spec.rb
fog-0.3.16 spec/aws/models/compute/key_pairs_spec.rb