Sha256: 06ac79debd5db1d0391f7f0eea9b6c8f9a9f676f8fca0258a86accb711b9181d
Contents?: true
Size: 1.52 KB
Versions: 9
Compression:
Stored size: 1.52 KB
Contents
require 'vagrant-openstack-provider/spec_helper' describe VagrantPlugins::Openstack::Command::SubnetList do describe 'cmd' do let(:neutron) do double('neutron').tap do |neutron| neutron.stub(:get_subnets) do [ Subnet.new('subnet-01', 'Subnet 1', '192.168.1.0/24', true, 'net-01'), Subnet.new('subnet-02', 'Subnet 2', '192.168.2.0/24', false, 'net-01'), Subnet.new('subnet-03', 'Subnet 3', '192.168.100.0/24', true, 'net-02') ] 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(:neutron) { neutron } end end before :each do @subnet_list_cmd = VagrantPlugins::Openstack::Command::SubnetList.new(nil, env) end it 'prints subnet list from server' do neutron.should_receive(:get_subnets).with(env) expect(env[:ui]).to receive(:info).with(' +-----------+----------+------------------+-------+------------+ | ID | Name | CIDR | DHCP | Network ID | +-----------+----------+------------------+-------+------------+ | subnet-01 | Subnet 1 | 192.168.1.0/24 | true | net-01 | | subnet-02 | Subnet 2 | 192.168.2.0/24 | false | net-01 | | subnet-03 | Subnet 3 | 192.168.100.0/24 | true | net-02 | +-----------+----------+------------------+-------+------------+') @subnet_list_cmd.cmd('subnet-list', [], env) end end end
Version data entries
9 entries across 9 versions & 2 rubygems