thoughtbot / appraisal

A Ruby library for testing your library against different versions of dependencies.
https://thoughtbot.com
MIT License
1.25k stars 107 forks source link

Fix `customize_gemfiles` on Ruby 3 #214

Closed yevhenii-ponomarenko closed 5 months ago

yevhenii-ponomarenko commented 10 months ago

Summary

https://github.com/thoughtbot/appraisal/pull/191 added an ability to customize headers in gemfiles generated by Appraisal, as well as creating the strings using single quotes. But there's a small bug with the implementation that prevents it from working on Ruby 3:

def customize_gemfiles(&_block)
  Customize.new(yield)
end

With changes in Ruby 3, the Hash yield'ed from the block needs to be converted into keyword arguments with **. This PR resolves the issue and provides tests to validate this behaviour.

This addresses #213.

joe-sharp commented 5 months ago

@nickcharlton you free to merge this?

nickcharlton commented 5 months ago

Great! Thanks for contributing this, and sorry for the delay.

@joe-sharp, thanks for the ping, I appreciate it.

luke-hill commented 4 months ago

@nickcharlton - This looks more like the issue I found

nickcharlton commented 4 months ago

Thanks! I'm keen to do a release with this, but I don't want to do so until I've gotten to the bottom of Bundler incompatibilities. In the short-term, you might wish to pin against the commit where this has been merged in.

tisba commented 4 months ago

@nickcharlton Do you suspect more issues? Or are we basically talking about #218?

nickcharlton commented 4 months ago

We're talking about #218. There are a few deprecation warnings I've been looking into, but I don't think those will be a problem just yet.

tisba commented 4 months ago

I would suggest to switch to absolute paths for the tests when referencing local git repositories. I'm still not 100% sure I understand Bundler intentions (see comments on https://github.com/rubygems/rubygems/pull/4475), but I'll try to spend some more time on it to understand this better.

If for appraisal this is just about its own specs, I'd just change them, tbh.

nickcharlton commented 4 months ago

Yeah, just changing them seems like a good idea. It's always going to be awkward working through private APIs like we seem to be.