Sha256: 15263e60264f7eb8f24f096d4ca370e6e16894a44c3147f5af253cd2b6f01bf3

Contents?: true

Size: 801 Bytes

Versions: 2

Compression:

Stored size: 801 Bytes

Contents

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

describe "VagrantPlugins::GuestBSD::Cap::Halt" do
  let(:caps) do
    VagrantPlugins::GuestBSD::Plugin
      .components
      .guest_capabilities[:bsd]
  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 -p now")
      cap.halt(machine)
    end

    it "ignores an IOError" do
      comm.stub_command("/sbin/shutdown -p 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/bsd/cap/halt_test.rb
vagrant-unbundled-1.8.5.1 test/unit/plugins/guests/bsd/cap/halt_test.rb