Sha256: 7a05a0c399945f90eee79c8610694108edb27b9c926fd7cac799cb4e4608af59

Contents?: true

Size: 1.07 KB

Versions: 16

Compression:

Stored size: 1.07 KB

Contents

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

class CommandsBoxRemoveTest < Test::Unit::TestCase
  setup do
    @klass = Vagrant::Commands::Box::Remove

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

    @env = mock_environment
    @env.stubs(:require_persisted_vm)
    @env.stubs(:vm).returns(@persisted_vm)

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

  context "executing" do
    setup do
      @name = "foo"
    end

    should "show help if not enough arguments" do
      Vagrant::Box.expects(:find).never
      @instance.expects(:show_help).once
      @instance.execute([])
    end

    should "error and exit if the box doesn't exist" do
      Vagrant::Box.expects(:find).returns(nil)
      @instance.expects(:error_and_exit).with(:box_remove_doesnt_exist).once
      @instance.execute([@name])
    end

    should "call destroy on the box if it exists" do
      @box = mock("box")
      Vagrant::Box.expects(:find).with(@env, @name).returns(@box)
      @box.expects(:destroy).once
      @instance.execute([@name])
    end
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
vagrantup-0.4.3.dev test/vagrant/commands/box/remove_test.rb
vagrantup-0.4.1 test/vagrant/commands/box/remove_test.rb
vagrantup-0.4.0 test/vagrant/commands/box/remove_test.rb
vagrantup-0.3.4 test/vagrant/commands/box/remove_test.rb
vagrantup-0.3.3 test/vagrant/commands/box/remove_test.rb
vagrantup-0.3.2 test/vagrant/commands/box/remove_test.rb
vagrantup-0.3.1 test/vagrant/commands/box/remove_test.rb
vagrantup-0.3.0 test/vagrant/commands/box/remove_test.rb
vagrant-0.4.2 test/vagrant/commands/box/remove_test.rb
vagrant-0.4.1 test/vagrant/commands/box/remove_test.rb
vagrant-0.4.0 test/vagrant/commands/box/remove_test.rb
vagrant-0.3.4 test/vagrant/commands/box/remove_test.rb
vagrant-0.3.3 test/vagrant/commands/box/remove_test.rb
vagrant-0.3.2 test/vagrant/commands/box/remove_test.rb
vagrant-0.3.1 test/vagrant/commands/box/remove_test.rb
vagrant-0.3.0 test/vagrant/commands/box/remove_test.rb