Skip to content
This repository has been archived by the owner on Dec 17, 2022. It is now read-only.

Commit

Permalink
Merge branch 'dev/remove.doubleshot'
Browse files Browse the repository at this point in the history
  • Loading branch information
twolfson committed Oct 19, 2015
2 parents 02d4008 + be52ef7 commit c72edae
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 128 deletions.
11 changes: 9 additions & 2 deletions .travis.yml
@@ -1,9 +1,16 @@
language: node_js
node_js:
- "4.0"
- "0.12"
- "0.11"
- "0.10"
- "0.8"
- "0.6"
matrix:
allow_failures:
- node_js: "0.11"

before_install:
# Upgrade npm to avoid semver issues
- curl --location http://rawgit.com/twolfson/fix-travis-ci/master/lib/install.sh | bash -s

notifications:
email: false
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"author": "Todd Wolfson <todd@twolfson.com> (http://twolfson.com/)",
"name": "jojo",
"description": "the 10 second blog-engine for hackers (in javascript)",
"version": "1.1.1",
"version": "1.1.0",
"homepage": "https://github.com/twolfson/jojo",
"repository": {
"type": "git",
Expand All @@ -13,10 +13,10 @@
},
"main": "src/jojo.js",
"engines": {
"node": ">= 0.8.0"
"node": ">= 0.10.0"
},
"scripts": {
"test": "doubleshot"
"test": "mocha"
},
"dependencies": {
"commander": "~2.0.0",
Expand All @@ -31,7 +31,7 @@
},
"devDependencies": {
"chai": "~1.7.2",
"doubleshot": "~2.12.0",
"mocha": "~2.3.3",
"foundry": "~4.3.2",
"foundry-release-git": "~2.0.2",
"foundry-release-npm": "~2.0.2",
Expand All @@ -43,4 +43,4 @@
"foundry-release-npm"
]
}
}
}
112 changes: 0 additions & 112 deletions test/jojo_test.content.js

This file was deleted.

98 changes: 98 additions & 0 deletions test/jojo_test.js
@@ -0,0 +1,98 @@
// Load in dependencies
var spawn = require('child_process').spawn,
request = require('request'),
expect = require('chai').expect;

var testUtils = {
spawn: function (cmd, args, options) {
before(function spawnChildProcess (done) {
// Start up a child server
this.child = spawn(cmd, args, options);

// After it loads, callback
setTimeout(done, 1000);
});
after(function killChildProcess (done) {
// Kill the child process
var child = this.child;
delete this.child;
child.kill();

// When it leaves, callback
child.on('exit', function (code) {
done();
});
});
},
request: function (url) {
before(function requestFn (done) {
var that = this;
request(url, function handleResponse (err, res, body) {
// Save the error, response, and body
that.err = err;
that.res = res;
that.body = body;

// Callback with the error
done(err);
});
});
after(function cleanup () {
delete this.err;
delete this.res;
delete this.body;
});
}
};

describe('jojo', function () {
describe('run via CLI', function () {
testUtils.spawn('node', ['../../../bin/jojo'], {
cwd: __dirname + '/test_files/cli'
});

testUtils.request('http://localhost:11550/1900-05-17-the-wonderful-wizard-of-oz');
it('serves articles', function () {
expect(this.body).to.contain('<h1>The Wonderful Wizard of Oz</h1>');
});
});

describe('integrated into a server', function () {
testUtils.spawn('node', ['app.js'], {
cwd: __dirname + '/test_files/integrated'
});

describe('with response to an index page', function () {
testUtils.request('http://localhost:11550/');
it('serves an index page', function () {
expect(this.body).to.contain('<section id="articles">');
expect(this.body).to.contain('the-wonderful-wizard-of-oz');
});
});

describe('with respect to articles', function () {
testUtils.request('http://localhost:11550/1900-05-17-the-wonderful-wizard-of-oz');
it('serves articles', function () {
expect(this.body).to.contain('<h1>The Wonderful Wizard of Oz</h1>');
});
});

describe('with response to RSS', function () {
testUtils.request('http://localhost:11550/index.xml');
it('serves an RSS feed', function () {
expect(this.body).to.contain('<id>/1900-05-17-the-wonderful-wizard-of-oz</id>');
});
});
});
});

describe('jojo running with no articles', function () {
testUtils.spawn('node', ['app.js'], {
cwd: __dirname + '/test_files/empty_app'
});

testUtils.request('http://localhost:11550/');
it('serves content', function () {
expect(this.body).to.contain('<section id="articles">');
});
});
9 changes: 0 additions & 9 deletions test/jojo_test.outline.yml

This file was deleted.

0 comments on commit c72edae

Please sign in to comment.