Sha256: c1c18e8f56ad25c4f75a54276eea4292a39a1bdda524a5e35a085ea8c98a9c01

Contents?: true

Size: 1.41 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
vagrant-conoha-0.1.10 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.9 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.8 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.7 spec/vagrant-conoha/command/volume_list_spec.rb
vagrant-conoha-0.1.6 spec/vagrant-conoha/command/volume_list_spec.rb