meteorcucumbermeteor-velocity

Stub a Meteor Method in Cucumber?


I would like to stub a Meteor method in Cucumber (using Velocity) so that when the Scenario runs and a button is clicked, I do not want it to send an email like it normally would.

My fixtures file in /tests/cucumber/fixtures/fixture.js contains a Meteor.method with the same name as a Meteor.method in the actual app. Of course, this prevents Meteor from running because Method names need to be unique.

I did notice the stubMethod() function here: https://meteor-testing.readme.io/docs/velocity-helpers, but this is marked as a Jasmine-only function.

How can I stub a Meteor method in Cucumber? Thanks.


Solution

  • Firstly you can use 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.