Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use RSpec.configure to use the matcher DSL #1048

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alyssais
Copy link
Contributor

@alyssais alyssais commented Mar 2, 2018

rspec-expectations shouldn't have knowledge of how to hook itself into rspec-core. rspec-core already includes the RSpec::Matchers module in example groups, so just including the module there (in addition to extending it) is enough to provide it to rspec-core, even if rspec-core hasn't been loaded yet and is loaded after rspec-expectations.

Fixes #1045.

rspec-expectations shouldn't have knowledge of how to hook itself into
rspec-core. rspec-core already includes the `RSpec::Matchers` module in
example groups, so just including the module there (in addition to
extending it) is enough to provide it to rspec-core, even if rspec-core
hasn't been loaded yet and is loaded after rspec-expectations.

Fixes rspec#1045.
@myronmarston
Copy link
Member

As the failing build indicates, this is not quite sufficient. In rspec-core, we include RSpec::Matchers but we do not extend it (nor should we: that would add a ton of methods to a context where we do not want those methods added!).

I think the only solution here is to update rspec-core to extend RSpec::Matchers::DSL. This can be done in the config.expect_with method, as part of the branch for rspec.

Once that's been done, I think we can remove the extend call being done in rspec-expectations and everything should continue working.

@pirj
Copy link
Member

pirj commented Jan 11, 2020

Are you still up to fix this @alyssais ?

@JonRowe JonRowe changed the base branch from master to main August 2, 2020 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Matcher DSL isn't available inside example groups if rspec-expectations is loaded before rspec-core.
3 participants