Sha256: fecb0e7de6ccc575e83ceb48e20e0eae2167c065cfbe1fe154f6343700c3cf91

Contents?: true

Size: 1.67 KB

Versions: 6

Compression:

Stored size: 1.67 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
      allow(IO).to receive(:read)
        .with('/project.rb')
        .and_return <<-EOH.gsub(/^ {10}/, '')
          name               '#{name}'
          maintainer         'Chef'
          homepage           'https://getchef.com'
          build_version      '#{version}'
          install_dir        '#{tmp_path}/opt/#{name}'
          mac_pkg_identifier 'test.pkg.#{name}'
        EOH

      Project.load('/project.rb')
    end

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

    before do
      # Tell things to install into the cache directory
      root = "#{tmp_path}/var/omnibus"
      Config.cache_dir "#{root}/cache"
      Config.git_cache_dir "#{root}/cache/git_cache"
      Config.source_dir "#{root}/src"
      Config.build_dir "#{root}/build"
      Config.package_dir "#{root}/pkg"
      Config.package_tmp "#{root}/pkg-tmp"

      # Enable DMG create
      Config.build_dmg true

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

      # Create the target directory
      FileUtils.mkdir_p(project.install_dir)
    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 = "#{Config.package_dir}/#{name}-#{version}-1.pkg"
      dmg = "#{Config.package_dir}/#{name}-#{version}-1.dmg"

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
omnibus-3.2.2 spec/integration/packagers/mac_spec.rb
omnibus-3.2.1 spec/integration/packagers/mac_spec.rb
omnibus-3.2.0 spec/integration/packagers/mac_spec.rb
omnibus-3.2.0.rc.3 spec/integration/packagers/mac_spec.rb
omnibus-3.2.0.rc.2 spec/integration/packagers/mac_spec.rb
omnibus-3.2.0.rc.1 spec/functional/packagers/mac_spec.rb