Sha256: a7a6d8418b6b0b3fe730bc23810f919bc76301d7892468a3eb79f1bc8716c41b

Contents?: true

Size: 1.1 KB

Versions: 49

Compression:

Stored size: 1.1 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet/face'

describe Puppet::Face[:plugin, :current] do

  let(:pluginface) { described_class }
  let(:action) { pluginface.get_action(:download) }

  def render(result)
    action.when_rendering(:console).call(result)
  end

  context "download" do
    before :each do
      Puppet.features.stubs(:external_facts?).returns(true)
    end

    it "downloads plugins and external facts" do
      Puppet::Configurer::Downloader.any_instance.expects(:evaluate).twice.returns([])

      pluginface.download
    end

    it "renders 'No plugins downloaded' if nothing was downloaded" do
      Puppet::Configurer::Downloader.any_instance.expects(:evaluate).twice.returns([])

      result = pluginface.download
      expect(render(result)).to eq('No plugins downloaded.')
    end

    it "renders comma separate list of downloaded file names" do
      Puppet::Configurer::Downloader.any_instance.expects(:evaluate).twice.returns(%w[/a]).then.returns(%w[/b])

      result = pluginface.download
      expect(render(result)).to eq('Downloaded these plugins: /a, /b')
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
puppet-4.5.3 spec/unit/face/plugin_spec.rb
puppet-4.5.3-x86-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.5.3-x64-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.5.3-universal-darwin spec/unit/face/plugin_spec.rb
puppet-4.5.2 spec/unit/face/plugin_spec.rb
puppet-4.5.2-x86-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.5.2-x64-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.5.2-universal-darwin spec/unit/face/plugin_spec.rb
puppet-4.5.1 spec/unit/face/plugin_spec.rb
puppet-4.5.1-x86-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.5.1-x64-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.5.1-universal-darwin spec/unit/face/plugin_spec.rb
puppet-4.5.0 spec/unit/face/plugin_spec.rb
puppet-4.5.0-x86-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.5.0-x64-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.5.0-universal-darwin spec/unit/face/plugin_spec.rb
puppet-4.4.2 spec/unit/face/plugin_spec.rb
puppet-4.4.2-x86-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.4.2-x64-mingw32 spec/unit/face/plugin_spec.rb
puppet-4.4.2-universal-darwin spec/unit/face/plugin_spec.rb