Sha256: 79325e63968f3359763d30adf6783a8aad86e5d5efab78258dfbf5dc645fb9c6

Contents?: true

Size: 1.33 KB

Versions: 22

Compression:

Stored size: 1.33 KB

Contents

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

require Vagrant.source_root.join("plugins/synced_folders/nfs/action_cleanup")

describe VagrantPlugins::SyncedFolderNFS::ActionCleanup do
  include_context "unit"

  let(:iso_env) do
    # We have to create a Vagrantfile so there is a root path
    env = isolated_environment
    env.vagrantfile("")
    env.create_vagrant_env
  end

  let(:host)    { double("host") }
  let(:machine) { iso_env.machine(iso_env.machine_names[0], :dummy) }

  let(:app) { lambda {} }
  let(:env) { {
    machine: machine,
  } }

  subject { described_class.new(app, env) }

  before do
    machine.env.stub(host: host)
  end

  it "does nothing if there are no valid IDs" do
    expect(app).to receive(:call).with(env)
    subject.call(env)
  end

  it "does nothing if the host doesn't support pruning NFS" do
    allow(host).to receive(:capability?).with(:nfs_prune).and_return(false)
    expect(host).to receive(:capability).never
    expect(app).to receive(:call).with(env)

    subject.call(env)
  end

  it "prunes the NFS entries if valid IDs are given" do
    env[:nfs_valid_ids] = [1,2,3]

    allow(host).to receive(:capability?).with(:nfs_prune).and_return(true)
    expect(host).to receive(:capability).with(:nfs_prune, machine.ui, [1,2,3]).ordered
    expect(app).to receive(:call).with(env).ordered

    subject.call(env)
  end
end

Version data entries

22 entries across 19 versions & 5 rubygems

Version Path
vagrant-unbundled-1.9.7.1 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-aws-mkubenka-0.7.2.pre.14 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-aws-mkubenka-0.7.2.pre.11 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-aws-mkubenka-0.7.2.pre.10 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-aws-mkubenka-0.7.2.pre.9 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-5333e60e2d38/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-unbundled-1.9.5.1 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-unbundled-1.9.1.1 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-unbundled-1.8.5.2 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-unbundled-1.8.5.1 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-unbundled-1.8.4.2 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-unbundled-1.8.4.1 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-unbundled-1.8.1.2 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-unbundled-1.8.1.1 test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/test/unit/plugins/synced_folders/nfs/action_cleanup_test.rb