Sha256: 637fb64cb05f2f9e22f8ae63f3b7ff7fceeca5e3e443a22ab25861691177693f

Contents?: true

Size: 875 Bytes

Versions: 4

Compression:

Stored size: 875 Bytes

Contents

require "test_helper"

class SuspendVMActionTest < Test::Unit::TestCase
  setup do
    @klass = Vagrant::Action::VM::Suspend
    @app, @env = mock_action_data

    @vm = mock("vm")
    @env["vm"] = @vm

    @internal_vm = mock("internal")
    @vm.stubs(:vm).returns(@internal_vm)

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

  context "calling" do
    should "run the proper methods when running" do
      @internal_vm.expects(:running?).returns(true)

      seq = sequence("seq")
      @internal_vm.expects(:save_state).once.in_sequence(seq)
      @app.expects(:call).with(@env).once.in_sequence(seq)
      @instance.call(@env)
    end

    should "do nothing if VM is not running" do
      @internal_vm.expects(:running?).returns(false)

      @internal_vm.expects(:save_state).never
      @app.expects(:call).with(@env).once
      @instance.call(@env)
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vagrantup-0.5.4 test/vagrant/action/vm/suspend_test.rb
vagrantup-0.5.3 test/vagrant/action/vm/suspend_test.rb
vagrant-0.5.4 test/vagrant/action/vm/suspend_test.rb
vagrant-0.5.3 test/vagrant/action/vm/suspend_test.rb