Sha256: 1cd2009d068d8af13d3a4e0c78f3dfda95326b625b181408dc1f9c275731a82f

Contents?: true

Size: 1007 Bytes

Versions: 11

Compression:

Stored size: 1007 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', '..', '..', 'test_helper')

class ImportActionTest < Test::Unit::TestCase
  setup do
    @mock_vm, @vm, @import = mock_action(Vagrant::Actions::VM::Import)

    @ovf_file = "foo"
    @box = mock("box")
    @box.stubs(:ovf_file).returns(@ovf_file)
    Vagrant::Env.stubs(:box).returns(@box)

    VirtualBox::VM.stubs(:import)
  end

  should "run in a busy block" do
    Vagrant::Busy.expects(:busy).once
    @import.execute!
  end

  should "invoke an around callback around the import" do
    @mock_vm.expects(:invoke_around_callback).with(:import).once
    @import.execute!
  end

  should "call import on VirtualBox::VM with the proper base" do
    VirtualBox::VM.expects(:import).once.with(@ovf_file)
    @import.execute!
  end

  should "set the resulting VM as the VM of the Vagrant VM object" do
    new_vm = mock("new_vm")
    @mock_vm.expects(:vm=).with(new_vm).once
    VirtualBox::VM.expects(:import).returns(new_vm)
    @import.execute!
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
vagrantup-0.1.4 test/vagrant/actions/vm/import_test.rb
vagrantup-0.1.3 test/vagrant/actions/vm/import_test.rb
vagrantup-0.1.2 test/vagrant/actions/vm/import_test.rb
vagrantup-0.1.1 test/vagrant/actions/vm/import_test.rb
vagrantup-0.1.0 test/vagrant/actions/vm/import_test.rb
vagrant-0.1.4 test/vagrant/actions/vm/import_test.rb
vagrant-0.1.4.pre.a test/vagrant/actions/vm/import_test.rb
vagrant-0.1.3 test/vagrant/actions/vm/import_test.rb
vagrant-0.1.2 test/vagrant/actions/vm/import_test.rb
vagrant-0.1.1 test/vagrant/actions/vm/import_test.rb
vagrant-0.1.0 test/vagrant/actions/vm/import_test.rb