From 0002c003b34cd57e0c2535d6f720be2d9fa3568a Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Sun, 5 Jun 2016 16:55:04 -0400 Subject: [PATCH] guests/photon: Improve docker tests --- .../plugins/guests/photon/cap/docker_test.rb | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/test/unit/plugins/guests/photon/cap/docker_test.rb b/test/unit/plugins/guests/photon/cap/docker_test.rb index 6a1c726ff..28c733fa4 100644 --- a/test/unit/plugins/guests/photon/cap/docker_test.rb +++ b/test/unit/plugins/guests/photon/cap/docker_test.rb @@ -1,26 +1,31 @@ -# encoding: UTF-8 # Copyright (c) 2015 VMware, Inc. All Rights Reserved. -require File.expand_path("../../../../../base", __FILE__) +require_relative "../../../../base" -describe "VagrantPlugins::GuestPhoton::Cap::Docker" do - let(:described_class) do - VagrantPlugins::GuestPhoton::Plugin.components.guest_capabilities[:photon].get(:docker_daemon_running) +describe "VagrantPlugins::GuestPhoton::Cap:Docker" do + let(:caps) do + VagrantPlugins::GuestPhoton::Plugin + .components + .guest_capabilities[:photon] end + let(:machine) { double("machine") } - let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) } - let(:old_hostname) { 'oldhostname.olddomain.tld' } + let(:comm) { VagrantTests::DummyCommunicator::Communicator.new(machine) } before do - allow(machine).to receive(:communicate).and_return(communicator) + allow(machine).to receive(:communicate).and_return(comm) end after do - communicator.verify_expectations! + comm.verify_expectations! end - it 'should check docker' do - expect(communicator).to receive(:test).with('test -S /run/docker.sock') - described_class.docker_daemon_running(machine) + describe ".docker_daemon_running" do + let(:cap) { caps.get(:docker_daemon_running) } + + it "installs rsync" do + comm.expect_command("test -S /run/docker.sock") + cap.docker_daemon_running(machine) + end end end