Sha256: eabb869fd8f9e62fa552ec04bc3d3d95f099c83c2db41b09a0dc126990147424

Contents?: true

Size: 896 Bytes

Versions: 10

Compression:

Stored size: 896 Bytes

Contents

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

class HaltActionTest < Test::Unit::TestCase
  setup do
    @runner, @vm, @action = mock_action(Vagrant::Actions::VM::Halt)
  end

  context "executing" do
    setup do
      @vm.stubs(:running?).returns(true)
    end

    should "invoke the 'halt' around callback" do
      halt_seq = sequence("halt_seq")
      @runner.expects(:invoke_around_callback).with(:halt).once.in_sequence(halt_seq).yields
      @vm.expects(:stop).in_sequence(halt_seq)
      @action.execute!
    end

    should "force the VM to stop" do
      @vm.expects(:stop).once
      @action.execute!
    end

    should "raise an ActionException if VM is not running" do
      @vm.stubs(:running?).returns(false)
      @vm.expects(:stop).never
      assert_raises(Vagrant::Actions::ActionException) {
        @action.execute!
      }
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
vagrantup-0.3.4 test/vagrant/actions/vm/halt_test.rb
vagrantup-0.3.3 test/vagrant/actions/vm/halt_test.rb
vagrantup-0.3.2 test/vagrant/actions/vm/halt_test.rb
vagrantup-0.3.1 test/vagrant/actions/vm/halt_test.rb
vagrantup-0.3.0 test/vagrant/actions/vm/halt_test.rb
vagrant-0.3.4 test/vagrant/actions/vm/halt_test.rb
vagrant-0.3.3 test/vagrant/actions/vm/halt_test.rb
vagrant-0.3.2 test/vagrant/actions/vm/halt_test.rb
vagrant-0.3.1 test/vagrant/actions/vm/halt_test.rb
vagrant-0.3.0 test/vagrant/actions/vm/halt_test.rb