Sha256: a9c0ed653d6c7ca8cca5cbc78a4b3af62b11d3311605589c094c0eceddfe605c

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

require 'tmpdir'

include Rake::Funnel::Support

describe Rake::Funnel::Support::Mono do
  before do
    allow(Rake::Win32).to receive(:windows?).and_return(windows?)
  end

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

    it 'should return executable' do
      expect(described_class.invocation('executable.exe')).to eq(%w(executable.exe))
    end

    it 'should return executable with args' do
      expect(described_class.invocation('executable.exe', 'arg1', 'arg2')).to eq(%w(executable.exe arg1 arg2))
    end

    it 'should return array executable with args' do
      expect(described_class.invocation(%w(executable.exe arg1 arg2))).to eq(%w(executable.exe arg1 arg2))
    end

    it 'should reject nil in array' do
      expect(described_class.invocation(%w(executable.exe arg1) << nil)).to eq(%w(executable.exe arg1))
    end

    it 'should reject nil as arg' do
      expect(described_class.invocation('executable.exe', nil)).to eq(%w(executable.exe))
    end
  end

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

    before do
      allow(Which).to receive(:which)
    end

    before do
      @cmd = described_class.invocation('executable.exe')
    end

    it "should prepend 'mono'" do
      expect(@cmd.first).to eq('mono') # rubocop:disable RSpec/InstanceVariable
    end

    it 'should resolve executable through which' do
      expect(Which).to have_received(:which).with('executable.exe')
    end

    it 'should support args' do
      expect(described_class.invocation(%w(executable.exe arg1 arg2))).to eq(%w(mono executable.exe arg1 arg2))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake-funnel-0.20.2 spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.20.1 spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.20.0 spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.19.0 spec/rake/funnel/support/mono_spec.rb