Sha256: 2d2042a24ca7d6360072d56d797fb06b4073f170329b3efc72285bbda32c9687

Contents?: true

Size: 1.72 KB

Versions: 8

Compression:

Stored size: 1.72 KB

Contents

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

describe 'Fog::AWS::EC2::Volumes' do

  describe "#all" do

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

    it "should include persisted volumes" do
      volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
      ec2.volumes.get(volume.id).should_not be_nil
      volume.destroy
    end

  end

  describe "#create" do

    before(:each) do
      @volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
    end

    after(:each) do
      @volume.destroy
    end

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

    it "should exist on ec2" do
      ec2.volumes.get(@volume.id).should_not be_nil
    end

  end

  describe "#get" do

    it "should return a Fog::AWS::EC2::Volume if a matching volume exists" do
      volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
      get = ec2.volumes.get(volume.id)
      volume.attributes.reject { |key, value| [:device, :status].include?(key) }.should == get.attributes.reject { |key, value| [:device, :status].include?(key) }
      volume.destroy
    end

    it "should return nil if no matching address exists" do
      ec2.volumes.get('vol-00000000').should be_nil
    end

  end

  describe "#new" do

    it "should return a Fog::AWS::EC2::Volume" do
      ec2.volumes.new.should be_a(Fog::AWS::EC2::Volume)
    end

  end

  describe "#reload" do

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

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

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