spec/rake/funnel/support/msbuild/build_tool_spec.rb in rake-funnel-0.18.0 vs spec/rake/funnel/support/msbuild/build_tool_spec.rb in rake-funnel-0.19.0

- old
+ new

@@ -1,35 +1,38 @@ +# rubocop:disable RSpec/FilePath + describe Rake::Funnel::Support::MSBuild::BuildTool do - before { + before do allow(Rake::Win32).to receive(:windows?).and_return(windows?) - } + end - context 'on Windows', platform: :win32 do + context 'on Windows', + skip: ('Windows Registry not available' unless defined?(::Win32::Registry)) do let(:windows?) { true } - before { - allow(::Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).and_yield({ 'MSBuildToolsPath' => 'path'}) - } + before do + allow(::Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).and_yield('MSBuildToolsPath' => 'path') + end it 'should search the registry for known MSBuild versions' do described_class.find expect(::Win32::Registry::HKEY_LOCAL_MACHINE).to have_received(:open).at_least(:once) end context 'MSBuild exists' do - before { + before do allow(File).to receive(:exist?).with('path/msbuild.exe').and_return(true) - } + end it 'should find msbuild.exe' do expect(described_class.find).to eq('path/msbuild.exe') end end context 'MSBuild does not exist' do - before { + before do allow(File).to receive(:exist?).with('path/msbuild.exe').and_return(false) - } + end it 'should not find msbuild.exe' do expect(described_class.find).to be_nil end end