Sha256: b20a730cf1174e6657d3e950307ec14727d10d7c5f72079e13e21e2ceb555359

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

require 'vagrant-deltacloud-provider/spec_helper'

describe VagrantPlugins::Deltacloud::Command::VolumeList do
  describe 'cmd' do

    let(:deltacloud) do
      double('deltacloud').tap do |deltacloud|
        deltacloud.stub(:list_volumes) do
          [Volume.new('987', 'vol-01', '2', 'available', 'true', nil, nil),
           Volume.new('654', 'vol-02', '4', 'in-use', 'false', 'inst-01', '/dev/vdc')]
        end
      end
    end

    let(:env) do
      Hash.new.tap do |env|
        env[:ui] = double('ui')
        env[:ui].stub(:info).with(anything)
        env.stub(:deltacloud_client) { deltacloud }
      end
    end

    before :each do
      @volume_list_cmd = VagrantPlugins::Deltacloud::Command::VolumeList.new(nil, env)
    end

    it 'prints volumes list from server' do
      deltacloud.should_receive(:list_volumes).with(env)
      expect(env[:ui]).to receive(:info).with('
+-----+--------+-----------+-----------+-------------------------------------+
| Id  | Name   | Size (Go) | Status    | Attachment (instance id and device) |
+-----+--------+-----------+-----------+-------------------------------------+
| 987 | vol-01 | 2         | available |                                     |
| 654 | vol-02 | 4         | in-use    | inst-01 (/dev/vdc)                  |
+-----+--------+-----------+-----------+-------------------------------------+')

      @volume_list_cmd.cmd('volume-list', [], env)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-deltacloud-provider-0.0.9 spec/vagrant-deltacloud-provider/command/volume_list_spec.rb
vagrant-deltacloud-provider-0.0.8 spec/vagrant-deltacloud-provider/command/volume_list_spec.rb
vagrant-deltacloud-provider-0.0.7 spec/vagrant-deltacloud-provider/command/volume_list_spec.rb
vagrant-deltacloud-provider-0.0.6 spec/vagrant-deltacloud-provider/command/volume_list_spec.rb
vagrant-deltacloud-provider-0.0.5 spec/vagrant-deltacloud-provider/command/volume_list_spec.rb
vagrant-deltacloud-provider-0.0.4 spec/vagrant-deltacloud-provider/command/volume_list_spec.rb
vagrant-deltacloud-provider-0.0.3 spec/vagrant-deltacloud-provider/command/volume_list_spec.rb
vagrant-deltacloud-provider-0.0.2 spec/vagrant-deltacloud-provider/command/volume_list_spec.rb