Skip to content

Commit

Permalink
added test to see if the qrencode lib is even installed right
Browse files Browse the repository at this point in the history
  • Loading branch information
bcelenza committed Apr 2, 2011
1 parent a31e7bc commit 6b64a4e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/encoder.js
Expand Up @@ -43,7 +43,9 @@ Encoder.prototype.encode = function(value, path, options)
var cmd_options = {}; var cmd_options = {};
if(options == null) options = {}; if(options == null) options = {};
for(var key in this.default_options) { for(var key in this.default_options) {
cmd_options[key] = (options[key] == undefined) ? this.default_options[key] : options[key]; cmd_options[key] = (options[key] == undefined) ?
this.default_options[key]
: options[key];
} }


// start with base set of args that we'll always pass // start with base set of args that we'll always pass
Expand Down
11 changes: 11 additions & 0 deletions test/encoder.js
Expand Up @@ -3,12 +3,23 @@ var vows = require('vows'),
assert = require('assert'), assert = require('assert'),
fs = require('fs'), fs = require('fs'),
util = require('util'), util = require('util'),
child_process = require('child_process'),
qr = require('../qr'); qr = require('../qr');


var Encoder = qr.Encoder; var Encoder = qr.Encoder;
var test_file_name = './test.png'; var test_file_name = './test.png';


vows.describe('Encoder').addBatch({ vows.describe('Encoder').addBatch({
'The libqrencode library': {
topic: function() {
var which = child_process.spawn('which', ['qrencode']);
which.on('exit', this.callback);
},
'is installed and available via $PATH': function(exit_code, process) {
assert.equal(exit_code, null, 'libqrencode does not appear to have been installed properly');
}
}
}).addBatch({
'The encoder': { 'The encoder': {
topic: new(Encoder), topic: new(Encoder),
'is an event emitter': function(encoder) { 'is an event emitter': function(encoder) {
Expand Down

0 comments on commit 6b64a4e

Please sign in to comment.