Ghost/core/test/unit/xmlrpc_spec.js

41 lines
1.2 KiB
JavaScript
Raw Normal View History

/*globals describe, beforeEach, afterEach, it*/
2014-06-05 01:26:03 +04:00
/*jshint expr:true*/
var nock = require('nock'),
should = require('should'),
sinon = require('sinon'),
testUtils = require('../utils'),
xmlrpc = require('../../server/xmlrpc'),
// storing current environment
currentEnv = process.env.NODE_ENV;
2014-06-05 01:26:03 +04:00
// To stop jshint complaining
should.equal(true, true);
describe('XMLRPC', function () {
var sandbox;
beforeEach(function () {
sandbox = sinon.sandbox.create();
// give environment a value that will ping
2014-06-05 01:26:03 +04:00
process.env.NODE_ENV = 'production';
});
afterEach(function () {
sandbox.restore();
// reset the environment
process.env.NODE_ENV = currentEnv;
});
it('should execute two pings', function () {
var ping1 = nock('http://blogsearch.google.com').post('/ping/RPC2').reply(200),
ping2 = nock('http://rpc.pingomatic.com').post('/').reply(200),
testPost = testUtils.DataGenerator.Content.posts[2];
/*jshint unused:false */
xmlrpc.ping(testPost);
ping1.isDone().should.be.true;
ping2.isDone().should.be.true;
});
});