Sha256: d871b9fe5451ff3ae88da8ecf8a93c977c882cb48e0e62362dbd6932fc9bfd62

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

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

describe "VagrantPlugins::GuestFreeBSD::Cap::MountNFSFolder" do
  let(:described_class) do
    VagrantPlugins::GuestFreeBSD::Plugin
      .components
      .guest_capabilities[:freebsd]
      .get(:mount_nfs_folder)
  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 ".mount_nfs_folder" do
    let(:ip) { "1.2.3.4" }

    it "mounts the folder" do
      folders = {
        "/vagrant-nfs" => {
          type: :nfs,
          guestpath: "/guest",
          hostpath: "/host",
        }
      }
      described_class.mount_nfs_folder(machine, ip, folders)

      expect(comm.received_commands[0]).to match(/mkdir -p '\/guest'/)
      expect(comm.received_commands[0]).to match(/'1.2.3.4:\/host' '\/guest'/)
    end

    it "mounts with options" do
      folders = {
        "/vagrant-nfs" => {
          type: :nfs,
          guestpath: "/guest",
          hostpath: "/host",
          nfs_version: 2,
        }
      }
      described_class.mount_nfs_folder(machine, ip, folders)

      expect(comm.received_commands[0]).to match(/mount -t nfs -o nfsv2/)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-unbundled-1.8.4.2 test/unit/plugins/guests/freebsd/cap/mount_nfs_folder_test.rb
vagrant-unbundled-1.8.4.1 test/unit/plugins/guests/freebsd/cap/mount_nfs_folder_test.rb