Skip to content

Commit 001949e

Browse files
committed
Add spec for -r being handled before parsing the main script
1 parent 609b6f8 commit 001949e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

command_line/dash_r_spec.rb

+10-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
end
88

99
it "requires the specified file" do
10-
result = ruby_exe(@script, options: "-r #{@test_file}")
11-
result.should include(@test_file + ".rb")
10+
out = ruby_exe(@script, options: "-r #{@test_file}")
11+
out.should include("REQUIRED")
12+
out.should include(@test_file + ".rb")
13+
end
14+
15+
it "requires the file before parsing the main script" do
16+
out = ruby_exe(fixture(__FILE__, "bad_syntax.rb"), options: "-r #{@test_file}", args: "2>&1")
17+
$?.should_not.success?
18+
out.should include("REQUIRED")
19+
out.should include("syntax error")
1220
end
1321
end

command_line/fixtures/test_file.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"test file"
1+
puts "REQUIRED"

0 commit comments

Comments
 (0)