From 224287744a0a520e97ee23e8a92516b188eae352 Mon Sep 17 00:00:00 2001 From: Javier Cervantes <1.27201@gmail.com> Date: Thu, 24 Apr 2014 10:14:16 -0500 Subject: [PATCH] Adding test for ssl disabled --- test/specs/api.spec.js | 47 +++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/test/specs/api.spec.js b/test/specs/api.spec.js index a420c54..c534a35 100644 --- a/test/specs/api.spec.js +++ b/test/specs/api.spec.js @@ -9,19 +9,20 @@ var API = source('api'); describe("API", function() { var api, opts; - beforeEach(function() { - stub(https, 'createServer').returns({ listen: spy() }); - - opts = { master: { name: 'master' } } - - api = new API(opts); - }); - - afterEach(function() { - https.createServer.restore(); - }); - describe("constructor", function() { + + beforeEach(function() { + stub(https, 'createServer').returns({ listen: spy() }); + + opts = { master: { name: 'master' } } + + api = new API(opts); + }); + + afterEach(function() { + https.createServer.restore(); + }); + it("sets @opts to the passed opts object", function() { expect(api.opts).to.be.eql(opts); }); @@ -56,6 +57,28 @@ describe("API", function() { var title = api.server.get('title'); expect(title).to.be.eql("Cylon API Server"); }); + + }); + + + describe("ssl disabled", function () { + + beforeEach(function() { + stub(https, 'createServer').returns({ listen: spy() }); + + opts = { ssl: false } + + api = new API(opts); + }); + + afterEach(function() { + https.createServer.restore(); + }); + + it("doesn't create https server", function() { + expect(https.createServer).not.to.be.calledWith(); + }); + }); describe("#configureRoutes", function() {