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

Fixes for promotion to default gem #132

Merged
merged 2 commits into from
Nov 5, 2019
Merged

Fixes for promotion to default gem #132

merged 2 commits into from
Nov 5, 2019

Conversation

kddnewton
Copy link
Contributor

Two things are going wrong in the test suite for ruby core ruby/ruby#2631. This attempts to fix both.

  1. assert_raises throws a NoMethodError from within ruby core. Not sure why? It says to use assert_raise so that what I've gone and replaced everything with. Test suite still passes just fine so I imagine it's an alias in some versions of test/unit and not in others. Weird.
  2. Due to the nature of how ruby core is running the tests, the bundled ruby did_you_mean is higher in the path than this gem's lib directory. So when you require did_you_mean, you actually end up testing the bundled version instead of the source code. Because of that, this commit changes the requires to be relative so that we're guaranteed to be requiring the correct code. There doesn't really appear to be a standard way to do this within Ruby core itself, it looks like it's different depending on the gem.

For the second point there, I'm not sure if that means there's something that should be done in Ruby core, but this will certainly fix it for just DYM.

Otherwise it fails with NoMethodError
Due to the nature of how ruby core is running the tests, the shipped ruby did_you_mean is higher in the path than this gem's lib directory. So when you require did_you_mean, you actually end up testing the shipped version instead of the source code. Because of that, this commit changes the requires to be relative so that we're guarunteed to be requiring the correct code. There doesn't really appear to be a standard way to do this within Ruby core itself, it looks like it's different depending on the gem.
@yuki24
Copy link
Member

yuki24 commented Nov 5, 2019

This is awesome, thanks for fixing this! I just quickly had a look at https://bugs.ruby-lang.org/issues/10222 and require_relative looks good in 2.7, so it should be good to go.

@yuki24 yuki24 merged commit d01696e into ruby:master Nov 5, 2019
@kddnewton kddnewton deleted the various-fixes branch November 5, 2019 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants