Sha256: b476435283e9889d4ed6b05b250ef308b20685cc867d5104ee4a4e54da22a816

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

module Omnibus
  describe Packager::MacDmg, :functional, :mac_only do
    let(:name) { 'sample' }
    let(:version) { '12.4.0' }

    let(:project) do
      Project.new(<<-EOH, __FILE__)
        name               '#{name}'
        maintainer         'Chef'
        homepage           'https://getchef.com'
        build_version      '#{version}'
        install_path       '#{tmp_path}/opt/#{name}'
        mac_pkg_identifier 'test.pkg.#{name}'
      EOH
    end

    let(:mac_packager) { Packager::MacPkg.new(project) }

    before do
      # Reset stale configuration
      Omnibus.config.reset!

      # Tell things to install into the cache directory
      root = "#{tmp_path}/var/omnibus"
      Omnibus.config.cache_dir "#{root}/cache"
      Omnibus.config.install_path_cache_dir "#{root}/cache/install_path"
      Omnibus.config.source_dir "#{root}/src"
      Omnibus.config.build_dir "#{root}/build"
      Omnibus.config.package_dir "#{root}/pkg"
      Omnibus.config.package_tmp "#{root}/pkg-tmp"

      # Enable DMG create
      Omnibus.config.build_dmg true

      # Point at our sample project fixture
      Omnibus.config.project_root "#{fixtures_path}/sample"

      # Create the target directory
      FileUtils.mkdir_p(project.install_path)
    end

    it 'builds a pkg and a dmg' do
      # Create the pkg resource
      mac_packager.run!

      # There is a tiny bit of hard-coding here, but I don't see a better
      # solution for generating the package name
      pkg = "#{project.package_dir}/#{name}-#{version}-1.pkg"
      dmg = "#{project.package_dir}/#{name}-#{version}-1.dmg"

      expect(File.exist?(pkg)).to be_true
      expect(File.exist?(dmg)).to be_true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
omnibus-3.1.1 spec/functional/packagers/mac_spec.rb
omnibus-3.1.0 spec/functional/packagers/mac_spec.rb