Sha256: f112bca2f9582e1070b12a84c5c65a42bce897f049b705f9be6f74061219b90e

Contents?: true

Size: 1.29 KB

Versions: 23

Compression:

Stored size: 1.29 KB

Contents

require 'spec_helper'
require 'r10k/action/puppetfile/purge'

describe R10K::Action::Puppetfile::Purge do
  let(:default_opts) { {root: "/some/nonexistent/path"} }
  let(:puppetfile) { instance_double('R10K::Puppetfile', :load! => nil) }

  def purger(opts = {}, argv = [], settings = {})
    opts = default_opts.merge(opts)
    return described_class.new(opts, argv, settings)
  end

  before(:each) do
    allow(R10K::Puppetfile).to receive(:new).with("/some/nonexistent/path", nil, nil).and_return(puppetfile)
  end

  it_behaves_like "a puppetfile action"

  it "purges unmanaged entries in the Puppetfile moduledir" do
    expect(puppetfile).to receive(:purge!)

    purger.call
  end

  describe "using custom paths" do
    before(:each) do
      allow(puppetfile).to receive(:purge!)
    end

    it "can use a custom puppetfile path" do
      expect(R10K::Puppetfile).to receive(:new).with("/some/nonexistent/path", nil, "/some/other/path/Puppetfile").and_return(puppetfile)

      purger({puppetfile: "/some/other/path/Puppetfile"}).call
    end

    it "can use a custom moduledir path" do
      expect(R10K::Puppetfile).to receive(:new).with("/some/nonexistent/path", "/some/other/path/site-modules", nil).and_return(puppetfile)

      purger({moduledir: "/some/other/path/site-modules"}).call
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
r10k-3.9.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.8.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.7.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.6.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.5.2 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.5.1 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.5.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.4.1 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.4.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.3.3 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.2.3 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.3.2 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.3.1 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.2.1 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.0.4 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.3.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.2.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.1.1 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.1.0 spec/unit/action/puppetfile/purge_spec.rb
r10k-3.0.3 spec/unit/action/puppetfile/purge_spec.rb