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

Commit feda686

Browse files
committed
dont double include pattern, let user override our default if necessary
1 parent eb47ad0 commit feda686

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lib/rspec/core/rake_task.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def file_inclusion_specification
102102
if ENV['SPEC']
103103
FileList[ENV['SPEC']].sort
104104
elsif String === pattern && !File.exist?(pattern)
105+
return if rspec_opts =~ /--pattern/
105106
"--pattern #{escape pattern}"
106107
else
107108
# Before RSpec 3.1, we used `FileList` to get the list of matched

spec/rspec/core/rake_task_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ def spec_command
6666
task.rspec_opts = "-Ifoo"
6767
expect(spec_command).to match(/#{task.rspec_path}.*-Ifoo/)
6868
end
69+
70+
it 'wont add --pattern if rspec_opts includes --pattern' do
71+
task.rspec_opts = "--pattern some_specs"
72+
expect(spec_command).to match(/#{task.rspec_path} --pattern some_specs$/)
73+
end
6974
end
7075

7176
context "with pattern" do

0 commit comments

Comments
 (0)