Sha256: a98518a1c5109d519bcf0cb12c87103b090286c73ea7af272b962de84ce9a1cc

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

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

class PluginHandlerTester
  include Puppet::Configurer::PluginHandler
  attr_accessor :environment
end

describe Puppet::Configurer::PluginHandler do
  before do
    @pluginhandler = PluginHandlerTester.new

    # 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 "should use an Agent Downloader, with the name, source, destination, ignore, and environment set correctly, to download plugins when downloading is enabled" do
    environment = Puppet::Node::Environment.create(:myenv, [])
    Puppet.features.stubs(:external_facts?).returns(:true)
    plugindest = File.expand_path("/tmp/pdest")
    Puppet[:pluginsource] = "psource"
    Puppet[:plugindest] = plugindest
    Puppet[:pluginsignore] = "pignore"
    Puppet[:pluginfactsource] = "psource"
    Puppet[:pluginfactdest] = plugindest

    downloader = mock 'downloader'
    Puppet::Configurer::Downloader.expects(:new).with("pluginfacts", plugindest, "psource", "pignore", environment).returns downloader
    Puppet::Configurer::Downloader.expects(:new).with("plugin", plugindest, "psource", "pignore", environment).returns downloader

    downloader.stubs(:evaluate).returns([])
    downloader.expects(:evaluate).twice

    @pluginhandler.download_plugins(environment)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-3.6.1 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.6.1-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.6.0 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.6.0-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.6.0.rc1 spec/unit/configurer/plugin_handler_spec.rb
puppet-3.6.0.rc1-x86-mingw32 spec/unit/configurer/plugin_handler_spec.rb