Skip to content

Commit acf00b2

Browse files
committed
Merge pull request alunny#2 from filmaj/updateProductName
Added test for updateProductName
2 parents 7ddd56b + 572223b commit acf00b2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/pbxProject.js

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var pbx = require('../lib/pbxProject'),
22
buildConfig = require('./fixtures/buildFiles'),
3+
fs = require('fs'),
34
project;
45

56
exports['creation'] = {
@@ -110,3 +111,25 @@ exports['generateUuid function'] = {
110111
test.done();
111112
}
112113
}
114+
115+
var bcpbx = 'test/parser/projects/build-config.pbxproj';
116+
var original_pbx = fs.readFileSync(bcpbx, 'utf-8');
117+
118+
exports['updateProductName function'] = {
119+
setUp:function(callback) {
120+
callback();
121+
},
122+
tearDown:function(callback) {
123+
fs.writeFileSync(bcpbx, original_pbx, 'utf-8');
124+
callback();
125+
},
126+
'should change the PRODUCT_NAME field in the .pbxproj file': function (test) {
127+
var myProj = new pbx('test/parser/projects/build-config.pbxproj');
128+
myProj.parse(function(err, hash) {
129+
myProj.updateProductName('furious anger');
130+
var newContents = myProj.writeSync();
131+
test.ok(newContents.match(/PRODUCT_NAME\s*=\s*"furious anger"/));
132+
test.done();
133+
});
134+
}
135+
}

0 commit comments

Comments
 (0)