 
             vm.runInContext(mGenerator.getEmptyJSContent(), context)
 
-
+    describe 'getJSContent', ->
+
+        it 'return valid js code with validation methods', ->
+
+            mGenerator = new ModelsGenerator()
+            definition = [
+                username:
+                    required: true
+                    min: 6,
+                    max: 10,
+                    pattern: '^[a-z]'
+            ]
+            result = mGenerator.getJSContent(definition)
+            assert /validatesPresenceOf\('username'\)/.test(result)
+            assert /validatesFormatOf\('username', \{ with: \/\^\[a-z\]\/ \}\)/.test(result)
+            assert /validatesLengthOf\('username', \{ max: 10 \}\)/.test(result)
+            assert /validatesLengthOf\('username', \{ min: 6 \}\)/.test(result)
 
     describe 'generateJSONandJS', ->
 

            content = fs.readFileSync(@generator.destinationDir + '/test-model.js', 'utf8')
            assert content is @generator.getEmptyJSContent()


    describe 'generateBuiltinModels', ->



                assert.deepEqual acls.splice(8, 4), acl

                done()
