[英]Can I see the active Cucumber options from within a Ruby step definition?
I'd like my step definition to have conditional behavior based on cuke's run-time options. 我希望我的步骤定义具有基于cuke的运行时选项的条件行为。 For example, I don't want my step to print terminal color codes if
cucumber
was executed with --no-color
. 例如,如果
cucumber
用--no-color
执行,我不希望我的步骤打印终端颜色代码。
Is there any way that I can programmatically see the cucumber run-time options from within the step definition? 有什么方法可以从步骤定义中以编程方式查看黄瓜运行时选项?
I'm not sure how to access all the run-time options, but you can access the current coloring option via Cucumber::Term::ANSIColor.coloring?
我不确定如何访问所有运行时选项,但是可以通过
Cucumber::Term::ANSIColor.coloring?
访问当前的着色选项Cucumber::Term::ANSIColor.coloring?
. 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.