
var removetask = require('../remove'),
    path = require('path'),
    fs = require('fs'),
    ajgenesis = require('ajgenesis'),
    fsutils = require('./lib/fsutils');
    
exports['remove project'] = function (test) {
    test.async();
    
    var cwd = process.cwd();
    fsutils.removeDirSync(path.join(__dirname, 'models'));
    process.chdir('test');
    ajgenesis.createDirectory('models');
    
    var filename = path.resolve(path.join(__dirname, 'models', 'project1.json'));
    fs.writeFileSync(filename, '{ "project1": true }');
    
    removetask(null, ['project1'], ajgenesis, function (err) {
        if (err)
            throw err;
        
        test.ok(!fs.existsSync(filename));
        fsutils.removeDirSync(path.join(__dirname, 'models'));
            
        test.done();
    });
    
    process.chdir(cwd);
}
    
exports['remove project property'] = function (test) {
    test.async();
    
    var cwd = process.cwd();
    fsutils.removeDirSync(path.join(__dirname, 'models'));
    process.chdir('test');
    ajgenesis.createDirectory('models');
    
    var filename = path.resolve(path.join(__dirname, 'models', 'project2.json'));
    fs.writeFileSync(filename, '{ "project2": { "name": "myproject", "title": "My Project" } }');
    
    removetask(null, ['project2', 'title'], ajgenesis, function (err) {
        if (err)
            throw err;
        
        test.ok(fs.existsSync(filename));
        var text = fs.readFileSync(filename).toString();
        eval("var model = " + text);
        
        test.ok(model);
        test.ok(model.project2);
        test.ok(model.project2.name);
        test.equal(model.project2.name, "myproject");
        test.strictEqual(model.project2.title, undefined);
        
        fsutils.removeDirSync(path.join(__dirname, 'models'));
            
        test.done();
    });
    
    process.chdir(cwd);
}

@@ -191,23 +191,21 @@
 'remove 
-project
+model
 '%5D = fun
@@ -475,23 +475,21 @@
 dels', '
-project
+model
 1.json')
@@ -527,23 +527,21 @@
 me, '%7B %22
-project
+model
 1%22: true
@@ -576,23 +576,21 @@
 null, %5B'
-project
+model
 1'%5D, ajg
@@ -876,23 +876,21 @@
 'remove 
-project
+model
  propert
@@ -1169,23 +1169,21 @@
 dels', '
-project
+model
 2.json')
@@ -1221,23 +1221,21 @@
 me, '%7B %22
-project
+model
 2%22: %7B %22n
@@ -1312,23 +1312,21 @@
 null, %5B'
-project
+model
 2', 'tit
@@ -1608,23 +1608,21 @@
 k(model.
-project
+model
 2);%0D%0A   
@@ -1644,125 +1644,1274 @@
 del.
-project2.name);%0D%0A        test.equal(model.project2.name, %22myproject%22);%0D%0A        test.strictEqual(model.project2.title
+model2.name);%0D%0A        test.equal(model.model2.name, %22myproject%22);%0D%0A        test.strictEqual(model.model2.title, undefined);%0D%0A        %0D%0A        fsutils.removeDirSync(path.join(__dirname, 'models'));%0D%0A            %0D%0A        test.done();%0D%0A    %7D);%0D%0A    %0D%0A    process.chdir(cwd);%0D%0A%7D%0D%0A    %0D%0Aexports%5B'remove model properties'%5D = function (test) %7B%0D%0A    test.async();%0D%0A    %0D%0A    var cwd = process.cwd();%0D%0A    fsutils.removeDirSync(path.join(__dirname, 'models'));%0D%0A    process.chdir('test');%0D%0A    ajgenesis.createDirectory('models');%0D%0A    %0D%0A    var filename = path.resolve(path.join(__dirname, 'models', 'model3.json'));%0D%0A    fs.writeFileSync(filename, '%7B %22model3%22: %7B %22name%22: %22myproject%22, %22title%22: %22My Project%22, %22notes%22: %22My notes%22 %7D %7D');%0D%0A    %0D%0A    removetask(null, %5B'model3', 'title', 'notes'%5D, ajgenesis, function (err) %7B%0D%0A        if (err)%0D%0A            throw err;%0D%0A        %0D%0A        test.ok(fs.existsSync(filename));%0D%0A        var text = fs.readFileSync(filename).toString();%0D%0A        eval(%22var model = %22 + text);%0D%0A        %0D%0A        test.ok(model);%0D%0A        test.ok(model.model3);%0D%0A        test.ok(model.model3.name);%0D%0A        test.equal(model.model3.name, %22myproject%22);%0D%0A        test.strictEqual(model.model3.title, undefined);%0D%0A        test.strictEqual(model.model3.notes
 , un

Remove properties, use modeln in remove test