provide support for example regex match
Created by: tansaku
Subject of the issue
We'd like to be able match regex when using the --example
switch. At the moment regex characters are escaped. That seems sensible, but sometimes we want to use regex example matches - could we have another switch like --example-regex?
Your environment
- Ruby version: 2.4
- rspec-core version: 3.7
Steps to reproduce
Check out this repo:
https://github.com/saasbook/hw-ruby-intro
run
rspec spec/part1_spec.rb --example '#sum'
or try
rspec spec/part1_spec.rb --example '#sum\b'
Expected behavior
we'd like only examples for the method #sum and not #sum_to_n
Actual behavior
we match both examples involving the method #sum and #sum_to_n or if using the \b regex then we match nothing