在黄瓜中存根流星方法?

Stub a Meteor Method in Cucumber?

我想在 Cucumber 中添加一个 Meteor 方法(使用 Velocity),这样当场景运行并单击按钮时,我不希望它像往常一样发送电子邮件。

我在 /tests/cucumber/fixtures/fixture.js 中的灯具文件包含一个 Meteor.method,其名称与实际应用程序中的 Meteor.method 同名。当然,这会阻止 Meteor 运行 因为方法名称需要是唯一的。

我确实注意到了这里的 stubMethod() 函数:https://meteor-testing.readme.io/docs/velocity-helpers,但这被标记为 Jasmine 专用函数。

如何在 Cucumber 中存根 Meteor 方法?谢谢

首先你可以使用xolvio:email-stub to stub Email. If you look through the source code you can see how the stub is built. Note that the docs on GH are a bit out of date, the method names are wrong. You can get the right ones from the code.