From 50690dab129ebd93876ca176325d7f0a19e67bbd Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Mon, 30 May 2016 22:48:16 -0400 Subject: [PATCH] guests/atomic: Add tests for docker capability This commit adds missing test coverage for the Docker capability on atomic guests. --- .../plugins/guests/atomic/cap/docker_test.rb | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/unit/plugins/guests/atomic/cap/docker_test.rb diff --git a/test/unit/plugins/guests/atomic/cap/docker_test.rb b/test/unit/plugins/guests/atomic/cap/docker_test.rb new file mode 100644 index 000000000..ab3b6489d --- /dev/null +++ b/test/unit/plugins/guests/atomic/cap/docker_test.rb @@ -0,0 +1,28 @@ +require_relative "../../../../base" + +describe "VagrantPlugins::GuestAtomic::Cap::ChangeHostName" do + let(:described_class) do + VagrantPlugins::GuestAtomic::Plugin + .components + .guest_capabilities[:atomic] + .get(:docker_daemon_running) + 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 ".docker_daemon_running" do + it "checks /run/docker/sock" do + described_class.docker_daemon_running(machine) + expect(comm.received_commands[0]).to eq("test -S /run/docker.sock") + end + end +end