File tree 4 files changed +30
-20
lines changed
4 files changed +30
-20
lines changed Original file line number Diff line number Diff line change 1
1
require_relative '../spec_helper'
2
+ require_relative 'shared/change_directory'
2
3
3
- describe 'The -C command line option' do
4
- before :all do
5
- @script = fixture ( __FILE__ , 'dash_upper_c_script.rb' )
6
- @tempdir = File . dirname ( @script )
7
- end
8
-
9
- it 'changes the PWD when using a file' do
10
- output = ruby_exe ( @script , options : "-C #{ @tempdir } " )
11
- output . should == @tempdir
12
- end
13
-
14
- it 'does not need a space after -C for the argument' do
15
- output = ruby_exe ( @script , options : "-C#{ @tempdir } " )
16
- output . should == @tempdir
17
- end
18
-
19
- it 'changes the PWD when using -e' do
20
- output = ruby_exe ( nil , options : "-C #{ @tempdir } -e 'print Dir.pwd'" )
21
- output . should == @tempdir
22
- end
4
+ describe "The -C command line option" do
5
+ it_behaves_like :command_line_change_directory , "-C"
23
6
end
Original file line number Diff line number Diff line change
1
+ require_relative '../spec_helper'
2
+ require_relative 'shared/change_directory'
3
+
4
+ describe "The -X command line option" do
5
+ it_behaves_like :command_line_change_directory , "-X"
6
+ end
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ describe :command_line_change_directory , shared : true do
2
+ before :all do
3
+ @script = fixture ( __FILE__ , 'change_directory_script.rb' )
4
+ @tempdir = File . dirname ( @script )
5
+ end
6
+
7
+ it 'changes the PWD when using a file' do
8
+ output = ruby_exe ( @script , options : "#{ @method } #{ @tempdir } " )
9
+ output . should == @tempdir
10
+ end
11
+
12
+ it 'does not need a space after -C for the argument' do
13
+ output = ruby_exe ( @script , options : "#{ @method } #{ @tempdir } " )
14
+ output . should == @tempdir
15
+ end
16
+
17
+ it 'changes the PWD when using -e' do
18
+ output = ruby_exe ( nil , options : "#{ @method } #{ @tempdir } -e 'print Dir.pwd'" )
19
+ output . should == @tempdir
20
+ end
21
+ end
You can’t perform that action at this time.
0 commit comments