spec/spec/runner/option_parser_spec.rb in rspec-1.1.8 vs spec/spec/runner/option_parser_spec.rb in rspec-1.1.9
- old
+ new
@@ -26,10 +26,16 @@
def parse(args)
@parser.parse(args)
@parser.options
end
+ it "should leave the submitted argv alone" do
+ args = ["--pattern", "foo"]
+ @parser.order!(args)
+ args.should == ["--pattern", "foo"]
+ end
+
it "should accept files to include" do
options = parse(["--pattern", "foo"])
options.filename_pattern.should == "foo"
end
@@ -64,15 +70,21 @@
it "should not use colour by default" do
options = parse([])
options.colour.should == false
end
- it "should print help to stdout if no args" do
- pending 'A regression since 1.0.8' do
- options = parse([])
- @out.rewind
- @out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m)
- end
+ it "should print help to stdout if no args and spec_comand?" do
+ Spec.stub!(:spec_command?).and_return(true)
+ options = parse([])
+ @out.rewind
+ @out.read.should match(/Usage: spec \(FILE\|DIRECTORY\|GLOB\)\+ \[options\]/m)
+ end
+
+ it "should not print help to stdout if no args and NOT spec_command?" do
+ Spec.stub!(:spec_command?).and_return(false)
+ options = parse([])
+ @out.rewind
+ @out.read.should == ""
end
it "should print help to stdout" do
options = parse(["--help"])
@out.rewind