Skip to content

Add `config.when_first_matching_example_defined`.

gitlab-qa-bot requested to merge when-first-matching-example-defined into master

Created by: myronmarston

In working on implementing the solution for #1920 (closed), I realized that implementing it becomes trivial if we have a hook like config.when_first_matching_example_defined so I decided to start there. We could stick with just this API -- focus filtering can be setup with the desired semantics with:

RSpec.configure do |config|
  config.when_first_matching_example_defined(:focus) do
    config.focus_run :focus
  end
end

It's probably still worth providing config.filter_run_when_matching for this common case, though.

Before merging this we at least need a cuke documenting it.

Thoughts, @rspec/rspec?

Merge request reports