Sha256: 2319a63526fcbb57842a10b33c2f2bab462a9d317c56b814743cdfda40fd6ba7

Contents?: true

Size: 974 Bytes

Versions: 59

Compression:

Stored size: 974 Bytes

Contents

require "test_helper"

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

    @vm = mock("vm")
    @env["vm"] = @vm

    @internal_vm = mock("internal")
    @vm.stubs(:vm).returns(@internal_vm)

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

  should "match the mac addresses" do
    nic = mock("nic")
    nic.expects(:mac_address=).once

    update_seq = sequence("update_seq")
    @internal_vm.expects(:network_adapters).returns([nic]).once.in_sequence(update_seq)
    @app.expects(:call).with(@env).once.in_sequence(update_seq)

    @env["vm.modify"].expects(:call).with() do |proc|
      proc.call(@internal_vm)
      true
    end

    @instance.call(@env)
  end

  should "raise an exception if no base MAC address is specified" do
    @env.env.config.vm.base_mac = nil

    assert_raises(Vagrant::Errors::VMBaseMacNotSpecified) {
      @instance.call(@env)
    }
  end
end

Version data entries

59 entries across 59 versions & 7 rubygems

Version Path
bmhatfield-vagrant-1.0.10 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
bmhatfield-vagrant-1.0.9 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
bmhatfield-vagrant-1.0.8 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
bmhatfield-vagrant-1.0.7 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-1.0.7 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-1.0.6 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-1.0.5 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-1.0.4 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-1.0.3 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-1.0.2 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-1.0.1 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-1.0.0 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-0.9.99.2 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-0.9.99.1 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-0.9.7 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-0.9.6 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-0.9.5 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-0.9.4 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-0.9.3 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb
vagrantup-0.9.2 test/unit_legacy/vagrant/action/vm/match_mac_address_test.rb