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

Ruby 2.5 fixes #2497

Merged
merged 3 commits into from Jan 2, 2018
Merged

Ruby 2.5 fixes #2497

merged 3 commits into from Jan 2, 2018

Conversation

myronmarston
Copy link
Member

This should get our test suite to green on Ruby 2.5. Note that https://bugs.ruby-lang.org/issues/14045 introduces a regression in RSpec (see my comment on note #5) so we'll probably need to backport this to the 3-7-maintenance branch and cut a release.

- `Module.new.define_method(:foo) { }` indicates that
  `Module#define_method` is private on Ruby < 2.5 and
  public on Ruby 2.5.
- The example related to frozen exceptions specified the
  behavior using an implementation detail of Ruby < 2.5,
  and is no longer applicable on 2.5.

Fixes part of #2488
This Ruby 2.5 feature is causing bugs with our hooks because
we depend upon `Hook#==` working properly for the same source
hook block. In Ruby 2.5 they introduced lazy proc allocation
which can result in two `Hook` instances which were previously
correctly considered to be equal to no longer be considered
equal. To work around this, we just need to invoke a method on
the proc before passing it along to other methods.

Note that there might be other bugs introduced by the Ruby 2.5
change, but this fixes the only test failures due to it, so this
is all we are changing for now.

Fixes #2488.
@xaviershay
Copy link
Member

LGTM, thanks for doing this!

@myronmarston myronmarston merged commit 1af055a into master Jan 2, 2018
@myronmarston myronmarston deleted the myron/ruby-2-5-fixes branch January 2, 2018 06:00
myronmarston added a commit that referenced this pull request Jan 3, 2018
MatheusRich pushed a commit to MatheusRich/rspec-core that referenced this pull request Oct 30, 2020
yujinakayama pushed a commit to yujinakayama/rspec-monorepo that referenced this pull request Oct 6, 2021
…-2-5-fixes

Ruby 2.5 fixes

---
This commit was imported from rspec/rspec-core@a26887b.
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.

None yet

2 participants