Sha256: 922cfbdecffedc8ba71f9e8b1b00e3065174a98fd68adfed3ed32b9ae92115b8

Contents?: true

Size: 1.63 KB

Versions: 8

Compression:

Stored size: 1.63 KB

Contents

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

describe "VagrantPlugins::VagrantPlugins::Cap::Rsync" do
  let(:plugin) { VagrantPlugins::GuestSmartos::Plugin.components.guest_capabilities[:smartos].get(:rsync_installed) }
  let(:machine) { double("machine") }
  let(:config) { double("config", smartos: VagrantPlugins::GuestSmartos::Config.new) }
  let(:communicator) { VagrantTests::DummyCommunicator::Communicator.new(machine) }

  before do
    machine.stub(:communicate).and_return(communicator)
    machine.stub(:config).and_return(config)
  end

  after do
    communicator.verify_expectations!
  end

  describe ".rsync_installed" do
    describe "when rsync is in the path" do
      it "is true" do
        communicator.stub_command("which rsync", stdout: '/usr/bin/rsync', exit_code: 0)
        expect(plugin.rsync_installed(machine)).to be true
      end
    end

    describe "when rsync is not in the path" do
      it "is false" do
        communicator.stub_command("which rsync", stdout: '', exit_code: 1)
        expect(plugin.rsync_installed(machine)).to be false
      end
    end
  end

  describe ".rsync_pre" do
    it 'makes the guestpath directory with pfexec' do
      communicator.expect_command("pfexec mkdir -p '/sync_dir'")
      plugin.rsync_pre(machine, guestpath: '/sync_dir')
    end
  end

  describe ".rsync_post" do
    it 'chowns incorrectly owned files in sync dir' do
      communicator.expect_command("pfexec find '/sync_dir' '(' ! -user somebody -or ! -group somegroup ')' -print0 | pfexec xargs -0 chown somebody:somegroup")
      plugin.rsync_post(machine, guestpath: '/sync_dir', owner: 'somebody', group: 'somegroup')
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/guests/smartos/cap/rsync_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/guests/smartos/cap/rsync_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/guests/smartos/cap/rsync_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/guests/smartos/cap/rsync_test.rb
vagrant-unbundled-1.8.5.2 test/unit/plugins/guests/smartos/cap/rsync_test.rb
vagrant-unbundled-1.8.5.1 test/unit/plugins/guests/smartos/cap/rsync_test.rb
vagrant-unbundled-1.8.4.2 test/unit/plugins/guests/smartos/cap/rsync_test.rb
vagrant-unbundled-1.8.4.1 test/unit/plugins/guests/smartos/cap/rsync_test.rb