summaryrefslogtreecommitdiffstats
path: root/packages/kadira-flow-router/test/server/_helpers.js
blob: c7538851b5cb0ef55c219ebdb4a1efecd369c4b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Meteor.publish('foo', function () {
  this.ready();
});

Meteor.publish('fooNotReady', function () {
});

Meteor.publish('bar', function () {
  this.ready();
});

// use this only to test global subs
Meteor.publish('baz', function () {
  this.ready();
});

Meteor.publish('bazNotReady', function () {
});

Meteor.publish('readyness', function (doIt) {
  if(doIt) {
    this.ready();
  }
});

InjectData = Package['meteorhacks:inject-data'].InjectData;
var urlResolve = Npm.require('url').resolve;
GetFRData = function GetFRData(path) {
  var url = urlResolve(process.env.ROOT_URL, path);
  // FastRender only servers if there is a accept header with html in it
  var options  = {
    headers: {'accept': 'html'}
  };
  var res = HTTP.get(url, options);

  var encodedData = res.content.match(/data">(.*)<\/script/)[1];
  return InjectData._decode(encodedData)['fast-render-data'];
}