             content = fs.readFileSync(@generator.destinationDir + '/test-model.js', 'utf8')
             assert content is @generator.getEmptyJSContent()
 
+    describe 'generateJSONandJS, when give the validation define', ->
+
+        before ->
+            @generator = new ModelsGenerator()
+            @generator.destinationDir = __dirname + '/a/b/c'
+
+            fs.mkdirsSync @generator.destinationDir
+
+            @modelName = 'test-model'
+            @definition =
+                patient:
+                    name: 'patient',
+                    plural: 'patient',
+                    properties:
+                        email:
+                            required: false
+                        username:
+                            type: 'string'
+                            required: true
+                    validations: [
+                        username:
+                            max: 10
+                            min: 6
+                    ]
+
+            modelDefinition = @generator.createModelDefinitions @definition
+            @generator.generateJSONandJS(@modelName, modelDefinition.patient)
+
+        after ->
+            fs.removeSync __dirname + '/a'
+
+        it 'generate non empty JS file', ->
+            content = fs.readFileSync(@generator.destinationDir + '/test-model.js', 'utf8')
+            assert /validatesLengthOf/.test(content)
+            assert /'username', { min: 6 }/.test(content)
 
     describe 'generateBuiltinModels', ->
 


            vm.runInContext(mGenerator.getEmptyJSContent(), context)



    describe 'generateJSONandJS', ->


            assert mergedConfig.hasOwnProperty 'a'
            assert not mergedConfig.hasOwnProperty 'b'

    describe 'getEmptyJSContent', ->

        it 'returns valid JS code', ->
