Sha256: 12b67fe7b3a7e071323b978d62b2303bd1e57f803af291defd1d3c6efca72487
Contents?: true
Size: 1.94 KB
Versions: 24
Compression:
Stored size: 1.94 KB
Contents
require 'spec_helper' describe Puppet::Type.type(:package).provider(:puppet_gem) do let(:resource) do Puppet::Type.type(:package).new( :name => 'myresource', :ensure => :installed ) end let(:provider) do provider = described_class.new provider.resource = resource provider end if Puppet::Util::Platform.windows? let(:puppet_gem) { 'gem' } else let(:puppet_gem) { '/opt/puppetlabs/puppet/bin/gem' } end before :each do resource.provider = provider end context "when installing" do it "should use the path to the gem" do described_class.expects(:which).with(puppet_gem).returns(puppet_gem) provider.expects(:execute).with { |args| args[0] == puppet_gem }.returns '' provider.install end it "should not append install_options by default" do provider.expects(:execute).with { |args| args.length == 5 }.returns '' provider.install end it "should allow setting an install_options parameter" do resource[:install_options] = [ '--force', {'--bindir' => '/usr/bin' } ] provider.expects(:execute).with { |args| args[2] == '--force' && args[3] == '--bindir=/usr/bin' }.returns '' provider.install end end context "when uninstalling" do it "should use the path to the gem" do described_class.expects(:which).with(puppet_gem).returns(puppet_gem) provider.expects(:execute).with { |args| args[0] == puppet_gem }.returns '' provider.install end it "should not append uninstall_options by default" do provider.expects(:execute).with { |args| args.length == 5 }.returns '' provider.uninstall end it "should allow setting an uninstall_options parameter" do resource[:uninstall_options] = [ '--force', {'--bindir' => '/usr/bin' } ] provider.expects(:execute).with { |args| args[5] == '--force' && args[6] == '--bindir=/usr/bin' }.returns '' provider.uninstall end end end
Version data entries
24 entries across 24 versions & 1 rubygems