Sha256: 85dd9a6d91c67c23d426487be25d590fe5cc7d777500875b84872321daf9431f

Contents?: true

Size: 1.52 KB

Versions: 172

Compression:

Stored size: 1.52 KB

Contents

require 'spec_helper'
require 'puppet/face'
require 'puppet/file_serving/metadata'
require 'puppet/file_serving/content'
require 'puppet/indirector/memory'

module PuppetFaceIntegrationSpecs
describe "Puppet plugin face" do
  INDIRECTORS = [
    Puppet::Indirector::FileMetadata,
    Puppet::Indirector::FileContent,
  ]

  INDIRECTED_CLASSES = [
    Puppet::FileServing::Metadata,
    Puppet::FileServing::Content,
    Puppet::Node::Facts,
  ]

  INDIRECTORS.each do |indirector|
    class indirector::Memory < Puppet::Indirector::Memory
      def find(request)
        model.new('/dev/null', { 'type' => 'directory' })
      end
    end
  end

  before do
    FileUtils.mkdir(File.join(Puppet[:vardir], 'lib'))
    FileUtils.mkdir(File.join(Puppet[:vardir], 'facts.d'))
    @termini_classes = {}
    INDIRECTED_CLASSES.each do |indirected|
      @termini_classes[indirected] = indirected.indirection.terminus_class
      indirected.indirection.terminus_class = :memory
    end
  end

  after do
    INDIRECTED_CLASSES.each do |indirected|
      indirected.indirection.terminus_class = @termini_classes[indirected]
      indirected.indirection.termini.clear
    end
  end

  def init_cli_args_and_apply_app(args = ["download"])
    Puppet::Application.find(:plugin).new(stub('command_line', :subcommand_name => :plugin, :args => args))
  end

  it "processes a download request" do
    app = init_cli_args_and_apply_app
    expect do
      expect {
        app.run
      }.to exit_with(0)
    end.to have_printed(/No plugins downloaded/)
  end
end
end

Version data entries

172 entries across 172 versions & 1 rubygems

Version Path
puppet-4.10.12 spec/integration/faces/plugin_spec.rb
puppet-4.10.12-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-4.10.12-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-4.10.12-universal-darwin spec/integration/faces/plugin_spec.rb
puppet-4.10.11 spec/integration/faces/plugin_spec.rb
puppet-4.10.11-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-4.10.11-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-4.10.11-universal-darwin spec/integration/faces/plugin_spec.rb
puppet-4.10.10 spec/integration/faces/plugin_spec.rb
puppet-4.10.10-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-4.10.10-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-4.10.10-universal-darwin spec/integration/faces/plugin_spec.rb
puppet-4.10.9 spec/integration/faces/plugin_spec.rb
puppet-4.10.9-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-4.10.9-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-4.10.9-universal-darwin spec/integration/faces/plugin_spec.rb
puppet-5.3.3 spec/integration/faces/plugin_spec.rb
puppet-5.3.3-x86-mingw32 spec/integration/faces/plugin_spec.rb
puppet-5.3.3-x64-mingw32 spec/integration/faces/plugin_spec.rb
puppet-5.3.3-universal-darwin spec/integration/faces/plugin_spec.rb