Sha256: 88c99e80de333cc13b9d9f5887a89d4f183a570261a34b1f5bd52ee00a1b4e01

Contents?: true

Size: 1.1 KB

Versions: 20

Compression:

Stored size: 1.1 KB

Contents

require "test_helper"

class DisableNetworksVMActionTest < Test::Unit::TestCase
  setup do
    @klass = Vagrant::Action::VM::DisableNetworks
    @app, @env = action_env

    @vm = mock("vm")
    @env.env.stubs(:vm).returns(@vm)

    @internal_vm = mock("internal")
    @vm.stubs(:created?).returns(true)
    @vm.stubs(:vm).returns(@internal_vm)
    @internal_vm.stubs(:network_adapters).returns([])

    @instance = @klass.new(@app, @env)
  end

  def mock_adapter(type)
    adapter = mock("adapter")
    adapter.stubs(:attachment_type).returns(type)

    if type == :host_only
      adapter.expects(:enabled=).with(false)
      adapter.expects(:save)
    end

    @internal_vm.network_adapters << adapter
  end

  should "do nothing if VM is not created" do
    @vm.stubs(:created?).returns(false)
    @vm.expects(:vm).never

    @app.expects(:call).with(@env).once
    @instance.call(@env)
  end

  should "remove all network adapters and continue chain" do
    mock_adapter(:bridged)
    mock_adapter(:host_only)
    mock_adapter(:host_only)

    @app.expects(:call).with(@env).once

    @instance.call(@env)
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
vagrantup-0.6.9 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.8 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.7 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.6 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.5 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.4 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.3 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.2 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.1 test/vagrant/action/vm/disable_networks_test.rb
vagrantup-0.6.0 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.9 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.8 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.7 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.6 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.5 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.4 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.3 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.2 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.1 test/vagrant/action/vm/disable_networks_test.rb
vagrant-0.6.0 test/vagrant/action/vm/disable_networks_test.rb