[英]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:我看到的唯一选择是:
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:与所有开源软件一样,您有几个选择:
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 的标准做法是:
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.