Permalink
Browse files

fix Meteor multiple servers .execute() (#556)

* add to each individual ddp instance

* change test to use ROOT_URL

* empty commit to trigger build
  • Loading branch information...
ejfrancis authored and samhatoum committed Jan 11, 2017
1 parent 3b82cae commit 2aee61de08a2972e4e3bf9e2146e39e92dca2a7a
Showing with 7 additions and 7 deletions.
  1. +5 −5 README.md
  2. +2 −2 src/lib/chimp-helper.js
View
@@ -157,11 +157,11 @@ chimp --watch --ddp=http://localhost:3005 --ddp=http://localhost:3007
Then you can access the servers in your tests on the global `server.instances` property
```
it('has PORT env var set', function() {
- function getPort() {
- return process.env.PORT;
- }
- expect(server.instances[0].execute(getPort)).to.equal(3005);
- expect(server.instances[1].execute(getPort)).to.equal(3007);
+ function getRootUrl() {
+ return process.env.ROOT_URL;
+ }
+ expect(server.instances[0].execute(getRootUrl)).to.equal('http://localhost:3005/');
+ expect(server.instances[1].execute(getRootUrl)).to.equal('http://localhost:3007/');
});
```
View
@@ -180,11 +180,11 @@ var chimpHelper = {
var timeout = parseInt(process.env['chimp.serverExecuteTimeout']) || 10000;
setTimeout(function() {
if (!result) {
- throw new Error('[chimp] server.execute timeout after ' + timeout + 'ms');
+ throw new Error('[chimp] server.execute timeout after ' + timeout + 'ms');
}
}, timeout);
try {
- result = server.call('xolvio/backdoor', func.toString(), args);
+ result = ddpInstance.call('xolvio/backdoor', func.toString(), args);
} catch (exception) {
if (exception.error === 404) {
throw new Error('[chimp] You need to install xolvio:backdoor in your meteor app before you can use server.execute()');

0 comments on commit 2aee61d

Please sign in to comment.