Sha256: 9a1762c8c207f5b5fd07c188ea7e5059be4718913c466d5a34a1788e6eab3e57

Contents?: true

Size: 1.52 KB

Versions: 92

Compression:

Stored size: 1.52 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/configurer'
require 'puppet/configurer/plugin_handler'

describe Puppet::Configurer::PluginHandler do
  let(:factory)       { Puppet::Configurer::DownloaderFactory.new }
  let(:pluginhandler) { Puppet::Configurer::PluginHandler.new(factory) }
  let(:environment)   { Puppet::Node::Environment.create(:myenv, []) }

  before :each do
    # PluginHandler#load_plugin has an extra-strong rescue clause
    # this mock is to make sure that we don't silently ignore errors
    Puppet.expects(:err).never
  end

  context "when external facts are supported" do
    before :each do
      Puppet.features.stubs(:external_facts?).returns(true)
    end

    it "downloads plugins and facts" do
      plugin_downloader = stub('plugin-downloader', :evaluate => [])
      facts_downloader = stub('facts-downloader', :evaluate => [])

      factory.expects(:create_plugin_downloader).returns(plugin_downloader)
      factory.expects(:create_plugin_facts_downloader).returns(facts_downloader)

      pluginhandler.download_plugins(environment)
    end

    it "returns downloaded plugin and fact filenames" do
      plugin_downloader = stub('plugin-downloader', :evaluate => %w[/a])
      facts_downloader = stub('facts-downloader', :evaluate => %w[/b])

      factory.expects(:create_plugin_downloader).returns(plugin_downloader)
      factory.expects(:create_plugin_facts_downloader).returns(facts_downloader)

      expect(pluginhandler.download_plugins(environment)).to match_array(%w[/a /b])
    end
  end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
puppet-4.10.12 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.12-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.12-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.12-universal-darwin spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.11 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.11-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.11-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.11-universal-darwin spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.10 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.10-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.10-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.10-universal-darwin spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.9 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.9-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.9-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.9-universal-darwin spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.8 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.8-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.8-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-4.10.8-universal-darwin spec/unit/configurer/plugin_handler_spec.rb