Skip to content

Commit a48257f

Browse files
committed
combine multiple pattern arguments
1 parent 26351b3 commit a48257f

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
### Development
2+
3+
Enhancements:
4+
5+
* Combine multiple `--pattern` arguments making them equivalent to
6+
`--pattern=1,2,...,n`. (Jon Rowe, #2002)
7+
18
### 3.3.0 / 2015-06-12
29
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.2.3...v3.3.0)
310

lib/rspec/core/option_parser.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,11 @@ def parser(options)
179179
end
180180

181181
parser.on('-P', '--pattern PATTERN', 'Load files matching pattern (default: "spec/**/*_spec.rb").') do |o|
182-
options[:pattern] = o
182+
if options[:pattern]
183+
options[:pattern] += ',' + o
184+
else
185+
options[:pattern] = o
186+
end
183187
end
184188

185189
parser.on('--exclude-pattern PATTERN',

spec/rspec/core/option_parser_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ def generate_help_text
214214
options = Parser.parse([option, 'spec/**/*.spec'])
215215
expect(options[:pattern]).to eq('spec/**/*.spec')
216216
end
217+
218+
it 'combines multiple patterns' do
219+
options = Parser.parse([option, 'spec/**/*.spec', option, 'tests/**/*.spec'])
220+
expect(options[:pattern]).to eq('spec/**/*.spec,tests/**/*.spec')
221+
end
217222
end
218223
end
219224

0 commit comments

Comments
 (0)