spec/unit/omnibus_spec.rb in omnibus-4.0.0 vs spec/unit/omnibus_spec.rb in omnibus-4.1.0

- old
+ new

@@ -5,30 +5,33 @@ before do allow(File).to receive(:directory?).and_return(true) allow(Gem::Specification).to receive(:find_all_by_name) .with('omnibus-software') - .and_return([double(gem_dir: '/gem/omnibus-software')]) + .and_return([double(gem_dir: File.join(tmp_path, '/gem/omnibus-software'))]) allow(Gem::Specification).to receive(:find_all_by_name) .with('custom-omnibus-software') - .and_return([double(gem_dir: '/gem/custom-omnibus-software')]) + .and_return([double(gem_dir: File.join(tmp_path, '/gem/custom-omnibus-software'))]) - Omnibus::Config.project_root('/foo/bar') - Omnibus::Config.local_software_dirs(['/local', '/other']) + Omnibus::Config.project_root(File.join(tmp_path, '/foo/bar')) + Omnibus::Config.local_software_dirs([File.join(tmp_path, '/local'), File.join(tmp_path, '/other')]) Omnibus::Config.software_gems(['omnibus-software', 'custom-omnibus-software']) end describe '#which' do it 'returns nil when the file does not exist' do stub_env('PATH', nil) expect(subject.which('not_a_real_executable')).to be nil end it 'returns the path when the file exists' do - ruby = Bundler.which('ruby') + + ruby_cmd = windows? ? 'ruby.exe' : 'ruby' + ruby = Bundler.which(ruby_cmd) expect(subject.which(ruby)).to eq(ruby) + expect(subject.which(ruby_cmd)).to eq(ruby) end end describe '#project_path' do before do @@ -74,9 +77,9 @@ /foo/bar/file /local/file /other/file /gem/omnibus-software/file /gem/custom-omnibus-software/file - )) + ).map { |path| File.join(tmp_path, path) }) end end end