Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monkey patch DDP callbacks to bubble up errors to Cucumber #1

Closed
samhatoum opened this issue Apr 7, 2015 · 4 comments
Closed

Monkey patch DDP callbacks to bubble up errors to Cucumber #1

samhatoum opened this issue Apr 7, 2015 · 4 comments

Comments

@samhatoum
Copy link
Member

currently you have to write:

this.Given(/^I have created a settings file with the title "([^"]*)"$/, function (title, callback) {
  this.ddp.call('updateTitle', [title], function(err, res) {
    if (err) { 
      callback.fail(err);
    } else {
      callback();
    }
  });
});

This would be much cleaner this way:

  this.ddp.call('updateTitle', [title], callback);

And can be achieved by monkey-patching global.ddp.call

@samhatoum samhatoum changed the title When using DDP callbacks, bubble up errors Monkey patch DDP callbacks to bubble up errors to Cucumber Apr 7, 2015
@ghost
Copy link

ghost commented Apr 7, 2015

I'd like to see a promise version of ddp.call and ddp.apply. So you don't pass a callback at all. E.g. `

this.ddp.callAsync('updateTitle', [title])
  .then(function () {
    // Do something else
  })
  .then(callback, callback) // If Cucumber supports Promises this can be removed

@dandv
Copy link
Contributor

dandv commented Aug 10, 2015

Would the newer DDP client from @pscanf (author of Asteroid) be a better choice than the fork of the old oortcloud one?

https://github.com/mondora/ddp.js

@samhatoum
Copy link
Member Author

Oh nice find. Didn't know about this one. I've always disliked the DDP client we currently use and this new one has tests which is nice.

I think with the sync version this problem has gone away (pending testing). I'll keep this issue open until we decide if it's worth switching to DDP.js

@ghost
Copy link

ghost commented Aug 10, 2015

We have solved this issue by forking the ddp npm package. https://github.com/mondora/ddp.js only provides the lower level DDP API. So we would need to create the high level API that Meteor provides on top of it. Because our current DDP package seems to work well, I don't see a reason for it right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants