Sha256: 0f43dee0d9af416c3c41de52b3b7d07dee557afc79dc1768db821f1a476138a8

Contents?: true

Size: 1.41 KB

Versions: 6

Compression:

Stored size: 1.41 KB

Contents

require 'vagrant-conoha/spec_helper'

describe VagrantPlugins::ConoHa::Command::VolumeList do
  describe 'cmd' do
    let(:cinder) do
      double('cinder').tap do |cinder|
        cinder.stub(:get_all_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
      {}.tap do |env|
        env[:ui] = double('ui')
        env[:ui].stub(:info).with(anything)
        env[:openstack_client] = double
        env[:openstack_client].stub(:cinder) { cinder }
      end
    end

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

    it 'prints volumes list from server' do
      cinder.should_receive(:get_all_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

6 entries across 6 versions & 1 rubygems

Version Path
vagrant-conoha-0.1.5 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.4 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.3 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.2 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.1 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.0 spec/vagrant-conoha/command/volume_list_spec.rb