Sha256: 8b468b33014b4f9c1baea2d7489ef39b92ab553fcb7a5ac8a5858624b9d69421

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

require 'vagrant-openstack-provider/spec_helper'

describe VagrantPlugins::Openstack::Command::FlavorList do
  describe 'cmd' do
    let(:nova) do
      double('nova').tap do |nova|
        nova.stub(:get_all_flavors) do
          [
            Flavor.new('001', 'small', '1', '1024', '10'),
            Flavor.new('002', 'large', '4', '4096', '100')
          ]
        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(:nova) { nova }
      end
    end

    before :each do
      @flavor_list_cmd = VagrantPlugins::Openstack::Command::FlavorList.new(nil, env)
    end

    it 'prints flovor list from server' do
      nova.should_receive(:get_all_flavors).with(env)

      expect(env[:ui]).to receive(:info).with('
+-----+-------+------+----------+----------------+
| ID  | Name  | vCPU | RAM (Mo) | Disk size (Go) |
+-----+-------+------+----------+----------------+
| 001 | small | 1    | 1024     | 10             |
| 002 | large | 4    | 4096     | 100            |
+-----+-------+------+----------+----------------+')

      @flavor_list_cmd.cmd('flavor-list', [], env)
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
vagrant-openstack-provider-0.13.0 spec/vagrant-openstack-provider/command/flavor_list_spec.rb
vagrant-openstack-provider-0.12.0 spec/vagrant-openstack-provider/command/flavor_list_spec.rb
vagrant-openstack-provider-illuin-0.11.1 spec/vagrant-openstack-provider/command/flavor_list_spec.rb
vagrant-openstack-provider-0.11.0 spec/vagrant-openstack-provider/command/flavor_list_spec.rb
vagrant-openstack-provider-0.10.0 spec/vagrant-openstack-provider/command/flavor_list_spec.rb
vagrant-openstack-provider-0.9.0 spec/vagrant-openstack-provider/command/flavor_list_spec.rb
vagrant-openstack-provider-0.8.0 spec/vagrant-openstack-provider/command/flavor_list_spec.rb
vagrant-openstack-provider-0.7.2 spec/vagrant-openstack-provider/command/flavor_list_spec.rb
vagrant-openstack-provider-0.7.1 spec/vagrant-openstack-provider/command/flavor_list_spec.rb