Sha256: ca10f4f3cc7d8692d0f3be53bb88b9c2d0ce8b256e5d8fe1f879844881639f98

Contents?: true

Size: 932 Bytes

Versions: 4

Compression:

Stored size: 932 Bytes

Contents

require "test_helper"

class DiscardStateVMActionTest < Test::Unit::TestCase
  setup do
    @klass = Vagrant::Action::VM::DiscardState
    @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
    setup do
      @internal_vm.stubs(:saved?).returns(false)
    end

    should "do nothing if not saved and continue chain" do
      @internal_vm.expects(:saved?).returns(false)
      @app.expects(:call).with(@env).once
      @instance.call(@env)
    end

    should "discard state and continue chain" do
      seq = sequence("sequence")
      @internal_vm.expects(:saved?).returns(true).in_sequence(seq)
      @internal_vm.expects(:discard_state).in_sequence(seq)
      @app.expects(:call).with(@env).once.in_sequence(seq)
      @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/discard_state_test.rb
vagrantup-0.5.3 test/vagrant/action/vm/discard_state_test.rb
vagrant-0.5.4 test/vagrant/action/vm/discard_state_test.rb
vagrant-0.5.3 test/vagrant/action/vm/discard_state_test.rb