diff --git a/command_line/dash_r_spec.rb b/command_line/dash_r_spec.rb index 0de9ba2e2..052ad5e63 100644 --- a/command_line/dash_r_spec.rb +++ b/command_line/dash_r_spec.rb @@ -25,4 +25,9 @@ out.should_not.include?("REQUIRED") out.should.include?("No such file or directory") end + + it "requires in order when given multiple times" do + ruby_exe("", options: "-r#{fixture(__FILE__, "test_file.rb")} -r#{fixture(__FILE__, "verbose.rb")}"). + should == "REQUIRED\nfalse\n" + end end diff --git a/command_line/rubyopt_spec.rb b/command_line/rubyopt_spec.rb index eb297cd6f..7ac875774 100644 --- a/command_line/rubyopt_spec.rb +++ b/command_line/rubyopt_spec.rb @@ -83,6 +83,12 @@ ruby_exe("0", args: '2>&1').should =~ /^rubyopt.rb required/ end + it "requires from CLI -r first and then from RUBYOPT -r" do + ENV["RUBYOPT"] = "-r#{fixture(__FILE__, "rubyopt.rb")}" + ruby_exe("", options: "-r#{fixture(__FILE__, "test_file.rb")}"). + should == "REQUIRED\nrubyopt.rb required\n" + end + it "raises a RuntimeError for '-a'" do ENV["RUBYOPT"] = '-a' ruby_exe("", args: '2>&1', exit_status: 1).should =~ /RuntimeError/