Sha256: c7472823633f8daecf0db6dadd452c1407aa73d78c5515e3c27ad2156f2a0d76

Contents?: true

Size: 1.33 KB

Versions: 48

Compression:

Stored size: 1.33 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

  it "downloads plugins and facts" do
    Puppet.features.stubs(:external_facts?).returns(true)

    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 "skips facts if not enabled" do
    Puppet.features.stubs(:external_facts?).returns(false)

    plugin_downloader = stub('plugin-downloader', :evaluate => [])

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

    pluginhandler.download_plugins(environment)
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.7-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.7-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.6 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.6-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.6-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.5 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.5-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.5-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.4 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.4-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.4-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.3 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.3-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.3-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.2 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.2-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.2-x64-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.1 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.8.1-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb