diff options
Diffstat (limited to 'spec/ruby/command_line/shared')
| -rw-r--r-- | spec/ruby/command_line/shared/change_directory.rb | 21 | ||||
| -rw-r--r-- | spec/ruby/command_line/shared/verbose.rb | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/spec/ruby/command_line/shared/change_directory.rb b/spec/ruby/command_line/shared/change_directory.rb new file mode 100644 index 0000000000..9cb6e90ac6 --- /dev/null +++ b/spec/ruby/command_line/shared/change_directory.rb @@ -0,0 +1,21 @@ +describe :command_line_change_directory, shared: true do + before :all do + @script = fixture(__FILE__, 'change_directory_script.rb') + @tempdir = File.dirname(@script) + end + + it 'changes the PWD when using a file' do + output = ruby_exe(@script, options: "#{@method} #{@tempdir}") + output.should == @tempdir + end + + it 'does not need a space after -C for the argument' do + output = ruby_exe(@script, options: "#{@method}#{@tempdir}") + output.should == @tempdir + end + + it 'changes the PWD when using -e' do + output = ruby_exe(nil, options: "#{@method} #{@tempdir} -e 'print Dir.pwd'") + output.should == @tempdir + end +end diff --git a/spec/ruby/command_line/shared/verbose.rb b/spec/ruby/command_line/shared/verbose.rb index 457fe3006a..c5c44c269e 100644 --- a/spec/ruby/command_line/shared/verbose.rb +++ b/spec/ruby/command_line/shared/verbose.rb @@ -4,6 +4,6 @@ describe :command_line_verbose, shared: true do end it "sets $VERBOSE to true" do - ruby_exe(@script, options: @method).chomp.split.last.should == "true" + ruby_exe(@script, options: @method).chomp.b.split.last.should == "true" end end |
