spec/functional/packagers/windows_spec.rb in omnibus-3.1.1 vs spec/functional/packagers/windows_spec.rb in omnibus-3.2.0.rc.1
- old
+ new
@@ -21,49 +21,50 @@
describe Packager::WindowsMsi, :functional, :windows_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}'
- EOH
+ 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}'
+ EOH
+
+ Project.load('/project.rb')
end
let(:windows_packager) { Packager::WindowsMsi.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"
+ 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"
# Point at our sample project fixture
- Omnibus.config.project_root "#{fixtures_path}/sample"
+ Config.project_root "#{fixtures_path}/sample"
# Create the target directory
- FileUtils.mkdir_p(project.install_path)
+ FileUtils.mkdir_p(project.install_dir)
# Create a file to be included in the MSI
- FileUtils.touch(File.join(project.install_path, 'golden_file'))
+ FileUtils.touch(File.join(project.install_dir, 'golden_file'))
end
it 'builds a pkg and a dmg' do
# Create the pkg resource
windows_packager.run!
# There is a tiny bit of hard-coding here, but I don't see a better
# solution for generating the package name
- expect(File.exist?("#{project.package_dir}/#{name}-#{version}-1.windows.msi")).to be_true
+ expect(File.exist?("#{Config.package_dir}/#{name}-#{version}-1.windows.msi")).to be_truthy
end
end
end