Sha256: d8ad61ae94b6c7fb80b81c721a670a261039cd0c88062069b3252f2ce6bbe2d8

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

require_relative "../../../../base"

describe "VagrantPlugins::GuestDarwin::Cap::Halt" do
  let(:caps) do
    VagrantPlugins::GuestDarwin::Plugin
      .components
      .guest_capabilities[:darwin]
  end

  let(:machine) { double("machine") }
  let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) }

  before do
    allow(machine).to receive(:communicate).and_return(comm)
  end

  after do
    comm.verify_expectations!
  end

  describe ".halt" do
    let(:cap) { caps.get(:halt) }

    it "runs the shutdown command" do
      comm.expect_command("/sbin/shutdown -h now")
      cap.halt(machine)
    end

    it "ignores an IOError" do
      comm.stub_command("/sbin/shutdown -h now", raise: IOError)
      expect {
        cap.halt(machine)
      }.to_not raise_error
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-unbundled-1.8.5.2 test/unit/plugins/guests/darwin/cap/halt_test.rb
vagrant-unbundled-1.8.5.1 test/unit/plugins/guests/darwin/cap/halt_test.rb