Sha256: e9c967d522facbfb137bd254faba6e222346b313458b8f22ebeed615fa19c723

Contents?: true

Size: 1.58 KB

Versions: 11

Compression:

Stored size: 1.58 KB

Contents

require 'tmpdir'

include Rake::Funnel::Support

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

  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 {
      allow(Which).to receive(:which)
    }

    before {
      @cmd = described_class.invocation('executable.exe')
    }

    it "should prepend 'mono'" do
      expect(@cmd.first).to eq('mono')
    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

11 entries across 11 versions & 1 rubygems

Version Path
rake-funnel-0.3.2.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.3.1.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.3.0.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.2.0.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.1.0.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.0.6.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.0.5.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.0.4.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.0.3.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.0.2.pre spec/rake/funnel/support/mono_spec.rb
rake-funnel-0.0.1.pre spec/rake/funnel/support/mono_spec.rb