Sha256: 6cc50205389d979fdd2a71efbdbf1e9f98a5c3ba9964feeb294aa6410377295a

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

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

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

  context "executing" do
    should "invoke an around callback around the destroy" do
      @runner.expects(:invoke_around_callback).with(:destroy).once
      @action.execute!
    end

    should "destroy VM and clear persist" do
      @runner.stubs(:invoke_around_callback).yields
      clear_seq = sequence("clear")
      @action.expects(:destroy_vm).in_sequence(clear_seq)
      @action.expects(:update_dotfile).in_sequence(clear_seq)
      @action.execute!
    end
  end

  context "destroying the VM" do
    should "destroy VM and attached images" do
      @vm.expects(:destroy).with(:destroy_medium => :delete).once
      @runner.expects(:vm=).with(nil).once
      @action.destroy_vm
    end
  end

  context "updating the dotfile" do
    should "update the environment dotfile" do
      @runner.env.expects(:update_dotfile).once
      @action.update_dotfile
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrantup-0.4.3.dev test/vagrant/actions/vm/destroy_test.rb
vagrantup-0.4.1 test/vagrant/actions/vm/destroy_test.rb
vagrantup-0.4.0 test/vagrant/actions/vm/destroy_test.rb
vagrant-0.4.2 test/vagrant/actions/vm/destroy_test.rb
vagrant-0.4.1 test/vagrant/actions/vm/destroy_test.rb
vagrant-0.4.0 test/vagrant/actions/vm/destroy_test.rb