简体   繁体   English

Ruby 3 的“机架测试”是否有替代方案?

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

We're using rack-test for our Cucumber specs.我们正在对我们的 Cucumber 规格进行rack-test 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.我们一直在尝试迁移到 Ruby 3 一段时间,当前的问题是 Cucumber 测试由于在其内部方法中使用关键字/位置参数进行rack-test测试而崩溃。

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.我准备自己修补它,但是看到 repo 上的活动很少(包括开放数周/数月的 PR),我担心我会做这项工作并且没有人可以修补它。

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寻找rack-test的替代解决方案

The last solution seems the best IMO.最后一个解决方案似乎是最好的 IMO。 So, are there any alternatives?那么,有没有其他选择?

As with all open source software , you have a few options:所有开源软件一样,您有几个选择:

  1. Keep using the old software version (ie don't use ruby v3.0.0).继续使用旧软件版本(即不要使用 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;目前,选项 1 完全可行; ruby 2.7 is still actively maintained, and support will probably continue until 2023-03-31 . ruby 2.7 仍在积极维护中,支持可能会持续到2023-03-31 You could do this, simply hoping that option 2 becomes available soon.可以这样做,只是希望选项 2 很快可用。

The standard practice for option 3 is:选项 3 的标准做法是:

  • 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.至于选项 4,与几乎所有库替换一样,在兼容性/功能之间总会有一些权衡,但显然其他测试框架确实存在。 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.总而言之,对于这样一个主观的问题,我真的无法给出客观的答案,但我目前的建议是:如果你现在有时间/技能/动机更新到 ruby 3,那么 fork 依赖项并更新它. (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.但是,如果您缺乏时间/技能/动力来执行此操作,那么现在就坚持使用 ruby 2.7。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM