Sha256: 80db7809f31baca4d4726674a2f33f7051c12e73b2a2af5dc81b529fa40b3417

Contents?: true

Size: 1013 Bytes

Versions: 10

Compression:

Stored size: 1013 Bytes

Contents

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

class CommandsUpTest < Test::Unit::TestCase
  setup do
    @klass = Vagrant::Commands::Up

    @env = mock_environment
    @instance = @klass.new(@env)

    @persisted_vm = mock("persisted_vm")
    @persisted_vm.stubs(:execute!)
  end

  context "executing" do
    setup do
      @new_vm = mock("vm")
      @new_vm.stubs(:execute!)

      @env.stubs(:vm).returns(nil)
      @env.stubs(:require_box)
      @env.stubs(:create_vm).returns(@new_vm)
    end

    should "require a box" do
      @env.expects(:require_box).once
      @instance.execute
    end

    should "call the up action on VM if it doesn't exist" do
      @new_vm.expects(:execute!).with(Vagrant::Actions::VM::Up).once
      @instance.execute
    end

    should "call start on the persisted vm if it exists" do
      @env.stubs(:vm).returns(@persisted_vm)
      @persisted_vm.expects(:start).once
      @env.expects(:create_vm).never
      @instance.execute
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
vagrantup-0.3.4 test/vagrant/commands/up_test.rb
vagrantup-0.3.3 test/vagrant/commands/up_test.rb
vagrantup-0.3.2 test/vagrant/commands/up_test.rb
vagrantup-0.3.1 test/vagrant/commands/up_test.rb
vagrantup-0.3.0 test/vagrant/commands/up_test.rb
vagrant-0.3.4 test/vagrant/commands/up_test.rb
vagrant-0.3.3 test/vagrant/commands/up_test.rb
vagrant-0.3.2 test/vagrant/commands/up_test.rb
vagrant-0.3.1 test/vagrant/commands/up_test.rb
vagrant-0.3.0 test/vagrant/commands/up_test.rb