Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 0b07308

Browse files
committed
combine multiple pattern arguments
1 parent 4698745 commit 0b07308

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ def generate_help_text
214214
options = Parser.parse([option, 'spec/**/*.spec'])
215215
expect(options[:pattern]).to eq('spec/**/*.spec')
216216
end
217+
it 'will combine multple patterns' do
218+
options = Parser.parse([option, 'spec/**/*.spec', option, 'tests/**/*.spec'])
219+
expect(options[:pattern]).to eq('spec/**/*.spec,tests/**/*.spec')
220+
end
217221
end
218222
end
219223

0 commit comments

Comments
 (0)