2018-03-04 10:09:32 -05:00
|
|
|
require_relative '../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe 'The -C command line option' do
|
|
|
|
before :all do
|
|
|
|
@script = fixture(__FILE__, 'dash_upper_c_script.rb')
|
|
|
|
@tempdir = File.dirname(@script)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'changes the PWD when using a file' do
|
|
|
|
output = ruby_exe(@script, options: "-C #{@tempdir}")
|
|
|
|
output.should == @tempdir
|
|
|
|
end
|
|
|
|
|
2018-06-13 17:58:54 -04:00
|
|
|
it 'does not need a space after -C for the argument' do
|
|
|
|
output = ruby_exe(@script, options: "-C#{@tempdir}")
|
|
|
|
output.should == @tempdir
|
|
|
|
end
|
|
|
|
|
2017-05-07 08:04:49 -04:00
|
|
|
it 'changes the PWD when using -e' do
|
|
|
|
output = ruby_exe(nil, options: "-C #{@tempdir} -e 'print Dir.pwd'")
|
|
|
|
output.should == @tempdir
|
|
|
|
end
|
|
|
|
end
|