Permalink
Browse files

[dist test] Move test/fixtures to examples

  • Loading branch information...
1 parent 539bf92 commit 9799b1b9e355496ceb173ccfbb3ca36e06325a6f @indexzero indexzero committed Feb 8, 2012
Showing with 36 additions and 26 deletions.
  1. +1 −1 .gitignore
  2. +30 −0 examples/app.js
  3. +1 −1 test/cli-config-test.js
  4. +4 −4 test/commands-test.js
  5. +0 −20 test/fixtures/app.js
View
@@ -1,3 +1,3 @@
npm-debug.log
node_modules
-test/fixtures/*.json
+examples/*.json
View
@@ -0,0 +1,30 @@
+var path = require('path'),
+ flatiron = require('flatiron'),
+ app = module.exports = flatiron.app;
+
+//
+// Configure the Application to be a CLI app with
+// a JSON configuration file `test-config.json`
+//
+app.name = 'app.js';
+app.config.file({ file: path.join(__dirname, 'test-config.json') });
+app.use(flatiron.plugins.cli, {
+ usage: 'A simple CLI app using cli-config'
+});
+
+//
+// Expose CLI commands using `cli-config`
+//
+app.use(require('../lib/cli-config'));
+
+//
+// TODO: This shouldn't be necessary
+//
+app.inspect = require('cliff');
+
+if (!module.parent) {
+ //
+ // Start the application
+ //
+ app.start();
+}
@@ -4,7 +4,7 @@ var assert = require('assert'),
vows.describe('cli-config').addBatch({
"When a flatiron plugin uses `cli-config`": {
- topic: require('./fixtures/app'),
+ topic: require('../examples/app'),
"should correctly extend the object": function (app) {
assert.isObject(app.commands);
assert.isObject(app.commands.config);
@@ -4,15 +4,15 @@ var assert = require('assert'),
path = require('path'),
cliEasy = require('cli-easy');
-var fixturesDir = path.join(__dirname, 'fixtures'),
- appBin = path.join(fixturesDir, 'app.js');
+var examplesDir = path.join(__dirname, '..', 'examples'),
+ appBin = path.join(examplesDir, 'app.js');
cliEasy.describe('cli-config/commands')
.discuss('When using the cli-config plugin')
.discuss('app config set testing 1234')
.use('node').args([appBin, 'config', 'set', 'testing', '1234'])
.expect('should update the config file', function () {
- var data = JSON.parse(fs.readFileSync(path.join(fixturesDir, 'test-config.json'), 'utf8'));
+ var data = JSON.parse(fs.readFileSync(path.join(examplesDir, 'test-config.json'), 'utf8'));
assert.equal(data.testing, 1234);
return true;
})
@@ -28,7 +28,7 @@ cliEasy.describe('cli-config/commands')
.discuss('app config delete testing')
.use('node').args([appBin, 'config', 'delete', 'testing'])
.expect('should update the config file', function () {
- var data = JSON.parse(fs.readFileSync(path.join(fixturesDir, 'test-config.json'), 'utf8'));
+ var data = JSON.parse(fs.readFileSync(path.join(examplesDir, 'test-config.json'), 'utf8'));
assert.isTrue(!data.testing);
return true;
})
View
@@ -1,20 +0,0 @@
-var path = require('path'),
- flatiron = require('flatiron'),
- app = module.exports = flatiron.app;
-
-app.use(flatiron.plugins.cli, {
- usage: 'A CLI app test fixture'
-});
-
-app.inspect = require('cliff');
-app.use(require('../../lib/cli-config'), {
- //
- // TODO: Options here?
- //
-});
-
-app.config.file({ file: path.join(__dirname, 'test-config.json') });
-
-if (!module.parent) {
- app.start();
-}

0 comments on commit 9799b1b

Please sign in to comment.