spec/rake/funnel/support/mono_spec.rb in rake-funnel-0.20.2 vs spec/rake/funnel/support/mono_spec.rb in rake-funnel-0.21.0
- old
+ new
@@ -1,17 +1,11 @@
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 }
-
+ shared_examples 'on Windows' do
it 'should return executable' do
expect(described_class.invocation('executable.exe')).to eq(%w(executable.exe))
end
it 'should return executable with args' do
@@ -29,13 +23,37 @@
it 'should reject nil as arg' do
expect(described_class.invocation('executable.exe', nil)).to eq(%w(executable.exe))
end
end
+ before do
+ allow(Rake::Win32).to receive(:windows?).and_return(windows?)
+ end
+
+ context 'on Windows' do
+ context 'plain Windows' do
+ let(:windows?) { true }
+
+ it_behaves_like 'on Windows'
+ end
+
+ context 'Windows Subsystem for Linux' do
+ let(:windows?) { false }
+
+ before do
+ allow(File).to receive(:readable?).with('/proc/version').and_return(true)
+ allow(File).to receive(:read).with('/proc/version').and_return('Microsoft')
+ end
+
+ it_behaves_like 'on Windows'
+ end
+ end
+
context 'not on Windows' do
let(:windows?) { false }
before do
+ allow(File).to receive(:readable?).with('/proc/version').and_return(false)
allow(Which).to receive(:which)
end
before do
@cmd = described_class.invocation('executable.exe')