Sha256: 74393be9b355ca7a49c0bca9c2e0ca671899b2fdcc9a79b6b44b6a9eef701d06

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

describe Rake::Funnel::Support::MSBuild::BuildTool do
  before {
    allow(Rake::Win32).to receive(:windows?).and_return(windows?)
  }

  context 'on Windows', platform: :win32 do
    let(:windows?) { true }

    before {
      allow(::Win32::Registry::HKEY_LOCAL_MACHINE).to receive(:open).and_yield({ 'MSBuildToolsPath' => 'path'})
    }

    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 {
        allow(File).to receive(:exist?).with('path/msbuild.exe').and_return(true)
      }

      it 'should find msbuild.exe' do
        expect(described_class.find).to eq('path/msbuild.exe')
      end
    end

    context 'MSBuild does not exist' do
      before {
        allow(File).to receive(:exist?).with('path/msbuild.exe').and_return(false)
      }

      it 'should not find msbuild.exe' do
        expect(described_class.find).to be_nil
      end
    end
  end

  context 'not on Windows' do
    let(:windows?) { false }

    it 'should find xbuild' do
      expect(described_class.find).to eq('xbuild')
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rake-funnel-0.18.0 spec/rake/funnel/support/msbuild/build_tool_spec.rb
rake-funnel-0.17.0 spec/rake/funnel/support/msbuild/build_tool_spec.rb
rake-funnel-0.16.1 spec/rake/funnel/support/msbuild/build_tool_spec.rb
rake-funnel-0.16.0 spec/rake/funnel/support/msbuild/build_tool_spec.rb
rake-funnel-0.15.0.pre spec/rake/funnel/support/msbuild/build_tool_spec.rb
rake-funnel-0.14.0.pre spec/rake/funnel/support/msbuild/build_tool_spec.rb
rake-funnel-0.13.0.pre spec/rake/funnel/support/msbuild/build_tool_spec.rb
rake-funnel-0.12.0.pre spec/rake/funnel/support/msbuild/build_tool_spec.rb