Search code examples
rubycucumberrackrack-testruby-3

Is there an alternative for `rack-test` for Ruby 3?


We're using rack-test for our Cucumber specs. We've been trying to migrate over to Ruby 3 for a while now and the current issue is that the Cucumber tests crash due to rack-test using both keyword/positional args in their internal methods.

I'm up for patching it myself, but seeing how little activity there is on the repo (including PRs open for weeks/months) I fear that I'd do the work and there would be nobody to patch it.

The only alternatives I see are:

  • Do the work and pray there will be someone to review/merge the changes
  • Patch it locally & use the patched version locally from now on (yuck)
  • Find an alternative solution for rack-test

The last solution seems the best IMO. So, are there any alternatives?


Solution

  • As with all open source software, you have a few options:

    1. Keep using the old software version (i.e. don't use ruby v3.0.0).
    2. Hope that someone else updates the dependencies for you.
    3. Do the update yourself.
    4. Stop using the library.

    At the moment, option 1 is totally viable; ruby 2.7 is still actively maintained, and support will probably continue until 2023-03-31. You could do this, simply hoping that option 2 becomes available soon.

    The standard practice for option 3 is:

    • Fork the project, and make the fixes.
    • Open a pull request to the main repo with your fixes. Hopefully it gets merged.
    • In the meantime, if you need to be unblocked, reference your forked repo in other projects.

    This is clearly more effort, but I wouldn't call it a "yuck" solution; not unless your changes are drastic/introduce compatibility issues with the main project, and the two branches diverge.

    As for option 4, as with virtually any library replacement, there's always going to be some trade-off between compatibility/features, but clearly other testing frameworks do exist. It depends how you are actually using it. Your mileage may vary.


    In summary, I can't really give an objective answer to such a subjective question, but my advice at the moment would be: If you have time/skill/motivation to update to ruby 3 right now, then fork the dependency and update it. (It's probably not a massive change needed!).

    But if you lack the time/skill/motivation to do this, then just stick with ruby 2.7 for now.