Skip to content

Commit

Permalink
avoiding the use of new on Error and removing ridiculous file path on…
Browse files Browse the repository at this point in the history
… a spec
  • Loading branch information
fabiomcosta committed Nov 15, 2011
1 parent c776cfc commit 41292fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions gmagick.js
Expand Up @@ -5,9 +5,9 @@ var gmagickModule = (process.env.GMAGICK_DEBUG != undefined)
var CImage = require(gmagickModule).Image;
var path = require('path');

var pathShouldBeSpecifiedError = new Error('Image path should be specified.');
var pathDoesNotExistsError = new Error('Image path does not exists.');
var invalidCropRegionError = new Error('Passed values make an invalid crop region.');
var pathShouldBeSpecifiedError = Error('Image path should be specified.');
var pathDoesNotExistsError = Error('Image path does not exists.');
var invalidCropRegionError = Error('Passed values make an invalid crop region.');

var Image = exports.Image = function(imagePath){
this.reset().readSync(imagePath);
Expand Down
10 changes: 7 additions & 3 deletions tests/gmagick.js
Expand Up @@ -3,8 +3,13 @@ var vows = require('vows'),
path = require('path'),
Image = require('../gmagick').Image;


var fixturePath = path.join(__dirname, 'fixtures'),
sourceImagePath = path.join(fixturePath, 'source.jpg');


var newImage = function(){
return new Image('fixtures/source.jpg');
return new Image(sourceImagePath);
};

vows.describe('Image Magick javascript module').addBatch({
Expand Down Expand Up @@ -42,10 +47,9 @@ vows.describe('Image Magick javascript module').addBatch({

'read method': {
topic: function(){
newImage().read('/Users/fabio/Sites/projects/js/node-gmagick/tests/fixtures/source.jpg', this.callback);
newImage().read(sourceImagePath, this.callback);
},
'should make the image available while on the callback': function(err, image){
console.log(image);
assert.equal(image, 1);
//assert.equal(image.size[0], 640);
//assert.equal(image.size[1], 480);
Expand Down

0 comments on commit 41292fe

Please sign in to comment.