From d7bc7c2267507f0e3391e2e3f50434f45937b6d7 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Sun, 5 Jun 2016 16:19:45 -0400 Subject: [PATCH] guests/omnios: Add rsync_install functionality --- plugins/guests/omnios/cap/rsync.rb | 11 +++++++ .../plugins/guests/omnios/cap/rsync_test.rb | 29 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 plugins/guests/omnios/cap/rsync.rb create mode 100644 test/unit/plugins/guests/omnios/cap/rsync_test.rb diff --git a/plugins/guests/omnios/cap/rsync.rb b/plugins/guests/omnios/cap/rsync.rb new file mode 100644 index 000000000..64cda9177 --- /dev/null +++ b/plugins/guests/omnios/cap/rsync.rb @@ -0,0 +1,11 @@ +module VagrantPlugins + module GuestOmniOS + module Cap + class RSync + def self.rsync_install(machine) + machine.communicate.sudo("pkg install rsync") + end + end + end + end +end diff --git a/test/unit/plugins/guests/omnios/cap/rsync_test.rb b/test/unit/plugins/guests/omnios/cap/rsync_test.rb new file mode 100644 index 000000000..86ff39e30 --- /dev/null +++ b/test/unit/plugins/guests/omnios/cap/rsync_test.rb @@ -0,0 +1,29 @@ +require_relative "../../../../base" + +describe "VagrantPlugins::GuestOmniOS::Cap:RSync" do + let(:caps) do + VagrantPlugins::GuestOmniOS::Plugin + .components + .guest_capabilities[:omnios] + 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 ".rsync_install" do + let(:cap) { caps.get(:rsync_install) } + + it "installs rsync" do + cap.rsync_install(machine) + expect(comm.received_commands[0]).to match(/pkg install rsync/) + end + end +end