test/javascripts/app_test.js in appjs-0.0.6 vs test/javascripts/app_test.js in appjs-0.0.7
- old
+ new
@@ -122,6 +122,38 @@
}, /not defined/i);
});
});
+ describe('overwrite', function () {
+ var namespace;
+
+ beforeEach(function () {
+ namespace = {};
+ App.induce(namespace);
+ });
+
+ it('temporarilly overwrites the Result of require', function () {
+ namespace.app.define('test', function () {
+ return 123
+ });
+
+ assert.equal(namespace.app.require('test'), 123)
+
+ var count = 0;
+ namespace.app.overwrite('test', function () {
+ count += 1;
+ return count;
+ });
+
+
+ assert.equal(namespace.app.require('test'), 1)
+ assert.equal(namespace.app.require('test'), 2)
+ assert.equal(namespace.app.require('test'), 3)
+
+ namespace.app.reset('test')
+
+ assert.equal(namespace.app.require('test'), 123)
+ });
+ });
+
});