Skip to content

Loading…

Remove `pattern` option from the `RSpec.configure` API #947

Closed
myronmarston opened this Issue · 5 comments

3 participants

@myronmarston
RSpec member

Since there's no way that option can ever do anything. pattern needs to be set before rspec loads any files (so that RSpec knows which files to load), and since RSpec.configure gets called in one of the pattern-matched loaded files (or, more typically from a file required by one of those files, such as spec_helper), it's too late to change pattern at that point. Thus, it's confusing for pattern to be an available option from `RSpec.configure.

For more background on this, see #682.

@soulcutter
RSpec member

I'd like to pick this one up over the weekend. Dibs!

@soulcutter soulcutter was assigned
@JonRowe
RSpec member

@myronmarston it can be though, because a 3rd-party gem could configure pattern in this way before loading the specs.

@myronmarston
RSpec member

@JonRowe -- good point. Maybe we should just warn that the option has no affect if it is set after RSpec has started loading the specs?

@soulcutter
RSpec member

Are you suggesting substituting a method on the configuration instance which spits out the warning, or just warning every time?

@myronmarston
RSpec member

I'm suggesting changing the method on the configuration instance such that it conditionally warns based on whether or not RSpec has already started loading the spec files.

@soulcutter soulcutter closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.