Sha256: 30eb839f3500e02cfa3caab6cc845dccc2ca84627b0feec88e290e4e37d6592d

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

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

class CommandsResumeTest < Test::Unit::TestCase
  setup do
    @klass = Vagrant::Commands::Resume

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

  context "executing" do
    should "call all or single for the method" do
      @instance.expects(:all_or_single).with([], :resume)
      @instance.execute
    end
  end

  context "resuming a single VM" do
    setup do
      @foo_vm = mock("vm")
      @foo_vm.stubs(:env).returns(@env)
      vms = { :foo => @foo_vm }
      @env.stubs(:vms).returns(vms)
    end

    should "error and exit if the VM doesn't exist" do
      @env.stubs(:vms).returns({})
      @instance.expects(:error_and_exit).with(:unknown_vm, :vm => :foo).once
      @instance.resume_single(:foo)
    end

    should "resume if its created" do
      @foo_vm.stubs(:created?).returns(true)
      @foo_vm.expects(:resume).once
      @instance.execute(["foo"])
    end

    should "do nothing if its not created" do
      @foo_vm.stubs(:created?).returns(false)
      @foo_vm.expects(:resume).never
      @instance.resume_single(:foo)
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrantup-0.4.3.dev test/vagrant/commands/resume_test.rb
vagrantup-0.4.1 test/vagrant/commands/resume_test.rb
vagrantup-0.4.0 test/vagrant/commands/resume_test.rb
vagrant-0.4.2 test/vagrant/commands/resume_test.rb
vagrant-0.4.1 test/vagrant/commands/resume_test.rb
vagrant-0.4.0 test/vagrant/commands/resume_test.rb