Sha256: 3590320c54fb10b48bb5896642f3c65c0b43b494ff26ee0fda51d8cf63e5b881

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

require File.expand_path('spec/spec_helper')
require 'fog/arubacloud/compute/models/disk'

describe Fog::ArubaCloud::Compute::Disk do
  include ModelSetup

  let (:disk_class) do
    class Fog::ArubaCloud::Compute::Disk
      def self.read_identity
        instance_variable_get('@identity')
      end
    end
    Fog::ArubaCloud::Compute::Disk
  end

  let(:service) { Object.new }
  let(:disk) { Fog::ArubaCloud::Compute::Disk.new }

  it 'must respond to #create' do
    disk.must_respond_to :create
  end

  describe '#create' do
    describe 'passing a wrong disk size >500GB' do
      before :each do
        disk.size = 600
        disk.virtual_disk_type = 1
      end

      it 'should raise BadDiskSize' do
        disk.stub(:service, service) do
          proc {disk.create}.must_raise Fog::ArubaCloud::Errors::BadDiskSize
        end
      end
    end

    describe 'passing wrong disk type (> 3)' do
      before :each do
        disk.size = 100
        disk.virtual_disk_type = 4
      end

      it 'should raise BadDiskNumber' do
        disk.stub(:service, service) do
          proc {disk.create}.must_raise Fog::ArubaCloud::Errors::BadDiskNumber
        end
      end
    end

    describe 'passing correct values' do
      before :each do
        disk.size = 100
        disk.virtual_disk_type = 1
      end

      it 'should return' do
        disk.stub(:service, service) do
          disk.create
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-arubacloud-0.0.6 spec/fog/compute/arubacloud/models/disk_spec.rb
fog-arubacloud-0.0.5 spec/fog/compute/arubacloud/models/disk_spec.rb