Sha256: 725f8a47fdf1cda6c9f004c4985c933d93fba032a547c2f025f83617d2c0faaf

Contents?: true

Size: 1.39 KB

Versions: 248

Compression:

Stored size: 1.39 KB

Contents

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

describe Puppet::Type.type(:package).provider(:appdmg) do
  let(:resource) { Puppet::Type.type(:package).new(:name => 'foo', :provider => :appdmg) }
  let(:provider) { described_class.new(resource) }

  describe "when installing an appdmg" do
    let(:fake_mountpoint) { "/tmp/dmg.foo" }
    let(:fake_hdiutil_plist) { {"system-entities" => [{"mount-point" => fake_mountpoint}]} }

    before do
      fh = mock 'filehandle'
      fh.stubs(:path).yields "/tmp/foo"
      resource[:source] = "foo.dmg"
      described_class.stubs(:open).yields fh
      Dir.stubs(:mktmpdir).returns "/tmp/testtmp123"
      FileUtils.stubs(:remove_entry_secure)
    end

    describe "from a remote source" do
      let(:tmpdir) { "/tmp/good123" }

      before :each do
        resource[:source] = "http://fake.puppetlabs.com/foo.dmg"
      end

      it "should call tmpdir and use the returned directory" do
        Dir.expects(:mktmpdir).returns tmpdir
        Dir.stubs(:entries).returns ["foo.app"]
        described_class.expects(:curl).with do |*args|
          args[0] == "-o" && args[1].include?(tmpdir) && ! args.include?("-k")
        end
        described_class.stubs(:hdiutil).returns 'a plist'
        Puppet::Util::Plist.expects(:parse_plist).with('a plist').returns fake_hdiutil_plist
        described_class.expects(:installapp)

        provider.install
      end
    end
  end
end

Version data entries

248 entries across 248 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/unit/provider/package/appdmg_spec.rb
puppet-6.4.0-x86-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-6.4.0-x64-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-6.4.0-universal-darwin spec/unit/provider/package/appdmg_spec.rb
puppet-6.0.7 spec/unit/provider/package/appdmg_spec.rb
puppet-6.0.7-x86-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-6.0.7-x64-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-6.0.7-universal-darwin spec/unit/provider/package/appdmg_spec.rb
puppet-5.5.12 spec/unit/provider/package/appdmg_spec.rb
puppet-5.5.12-x86-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-5.5.12-x64-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-5.5.12-universal-darwin spec/unit/provider/package/appdmg_spec.rb
puppet-6.3.0 spec/unit/provider/package/appdmg_spec.rb
puppet-6.3.0-x86-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-6.3.0-x64-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-6.3.0-universal-darwin spec/unit/provider/package/appdmg_spec.rb
puppet-6.2.0 spec/unit/provider/package/appdmg_spec.rb
puppet-6.2.0-x86-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-6.2.0-x64-mingw32 spec/unit/provider/package/appdmg_spec.rb
puppet-6.2.0-universal-darwin spec/unit/provider/package/appdmg_spec.rb