Skip to content

Commit a9c6a71

Browse files
committed
Use ./spec directory if it exists and no files are specified.
1 parent 69c388b commit a9c6a71

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/mspec/commands/mspec-run.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ def options(argv=ARGV)
7171
options.doc "\n $ mspec --spec-debug -S 'this crashes' path/to/the_file_spec.rb"
7272
options.doc "\n 4. To run some specs matching 'this crashes'"
7373
options.doc "\n $ mspec -e 'this crashes' path/to/the_file_spec.rb"
74-
74+
7575
options.doc ""
7676

7777
patterns = options.parse argv
7878
patterns = config[:files] if patterns.empty?
79+
patterns = "spec/" if patterns.empty? and File.directory? "./spec"
7980
if patterns.empty?
8081
puts options
8182
puts "No files specified."

spec/commands/mspec_run_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@
118118
@script.options @argv
119119
end
120120

121-
it "exits if there are no files to process" do
121+
it "exits if there are no files to process and './spec' is not a directory" do
122+
File.should_receive(:directory?).with("./spec").and_return(false)
122123
@options.should_receive(:parse).and_return([])
123124
@script.should_receive(:exit)
124125
@script.options

0 commit comments

Comments
 (0)