Permalink
Browse files

Added the CONTROLLER_JS and TESTCONTROLLER_JS templates.

  • Loading branch information...
1 parent d5a839c commit 52ecea5dc2a335b2a27d8788d91b3ec2363a4bd9 @mr-rock mr-rock committed Mar 11, 2012
Showing with 50 additions and 0 deletions.
  1. +50 −0 .alice/javascript
View
@@ -38,6 +38,56 @@ TESTMODULE_JS += "\n\n\tdescribe('\#example', function() {\
\n\t});\
\n})"
+CONTROLLER_JS = "var $(NAME) = exports = module.exports = function() {\
+\n\tvar value1 = 0;\
+\n\tvar value2 = 0;\
+\n\n\tfunction method1() {\
+\n\t\t// ... your code goes in here ...\
+\n\t}\
+\n\n\tfunction method2() {\
+\n\t\t// ... your code goes in here ...\
+\n\t}\
+\n\n\treturn {\
+\n\t\tvalue2: value2,\
+\n\t\tmethod2: method2\
+\n\t}\
+\n};"
+
+ifeq "$(GROUP)" ""
+TESTCONTROLLER_JS = "describe('$(NAME)', function() {\
+\n\tvar $(NAME) = require('../../$(LIBRARIES_DIRECTORY)/$(NAME_CAMELIZED)');"
+else
+TESTCONTROLLER_JS = "describe('$(GROUP) > $(NAME)', function() {\
+\n\tvar $(NAME) = require('../../../$(LIBRARIES_DIRECTORY)/$(GROUP_CAMELIZED)/$(NAME_CAMELIZED)');"
+endif
+
+TESTCONTROLLER_JS += "\n\tvar controller = new $(NAME)();\
+\n\n\tdescribe('\#value1', function() {\
+\n\t\tit('should not exist', function(done) {\
+\n\t\t\tcontroller.should.not.have.property('value1');\
+\n\t\t\tdone();\
+\n\t\t});\
+\n\t});\
+\n\n\tdescribe('\#value2', function() {\
+\n\t\tit('should exist', function(done) {\
+\n\t\t\tcontroller.should.have.property('value2');\
+\n\t\t\tdone();\
+\n\t\t});\
+\n\t});\
+\n\n\tdescribe('\#method1()', function() {\
+\n\t\tit('should not exist', function(done) {\
+\n\t\t\tcontroller.should.not.have.property('method1');\
+\n\t\t\tdone();\
+\n\t\t});\
+\n\t});\
+\n\n\tdescribe('\#method2()', function(){\
+\n\t\tit('should exist', function(done){\
+\n\t\t\tcontroller.should.have.property('method2');\
+\n\t\t\tdone();\
+\n\t\t});\
+\n\t});\
+\n});"
+
MODEL_JS = "var $(NAME) = exports = module.exports = function $(NAME)() {\
\n\tvar counter = -1;\
\n\tvar index = 0;\

0 comments on commit 52ecea5

Please sign in to comment.