diff --git a/generators/demo/index.js b/generators/demo/index.js
index 09f9a35f..2737b6d8 100644
--- a/generators/demo/index.js
+++ b/generators/demo/index.js
@@ -126,7 +126,7 @@ var DemoGenerator = generators.Base.extend(
// Testing example:
, 'src/models/example.coffee'
- , 'test/example.coffee'
+ , 'test/unit/spec/models/example.spec.coffee'
]
;
diff --git a/generators/demo/templates/src/models/example.coffee b/generators/demo/templates/src/models/example.coffee
index 2181f3cf..368a4b1c 100644
--- a/generators/demo/templates/src/models/example.coffee
+++ b/generators/demo/templates/src/models/example.coffee
@@ -41,8 +41,8 @@
###
defaults:
- propertyOne: 'this should be a string'
- propertyTwo: true
+ attributeOne: 'this should be a string'
+ attributeTwo: true
###*
diff --git a/generators/demo/templates/src/views/buildscript.hbs b/generators/demo/templates/src/views/buildscript.hbs
index 1c341ad9..3705fa91 100644
--- a/generators/demo/templates/src/views/buildscript.hbs
+++ b/generators/demo/templates/src/views/buildscript.hbs
@@ -47,7 +47,7 @@
minify your compiled and bundled code
- MochaTest:
+ Karma:
test your build
diff --git a/generators/demo/templates/test/example.coffee b/generators/demo/templates/test/example.coffee
deleted file mode 100644
index 0ebc569d..00000000
--- a/generators/demo/templates/test/example.coffee
+++ /dev/null
@@ -1,68 +0,0 @@
-chai = require( 'chai' )
-expect = chai.expect
-ExampleModel = require( '../src/models/example.coffee' )
-
-# Create a model instance
-#
-
-describe( 'exampleModel tests:', () ->
-
- # Create an instance without any data to test the defaults
- #
- emptyModel = new ExampleModel()
-
- describe( 'defaults', () ->
-
- it( 'propertyOne should be a string', () ->
- expect( emptyModel.get( 'propertyOne' ) ).to.be.a( 'string' )
- )
-
- it( 'propertyTwo should be a boolean', () ->
- expect( emptyModel.get( 'propertyTwo' ) ).to.be.a( 'boolean' )
- )
- )
-
- # Test the set function by overwriting one of the defaults
- #
- describe( 'set', () ->
-
- it( 'try setting a property', () ->
-
- newString = 'This should be overriden now'
-
- emptyModel.set( 'propertyOne', newString )
-
- expect( emptyModel.get( 'propertyOne' ) ).to.equal( newString )
- )
- )
-
- # Test the model when passing it data, check if defaults are overriden
- #
- filledModel = new ExampleModel( {
- propertyOne: 'This should be overriden now'
- propertyTwo: false
- } )
-
- describe( 'Override defaults', () ->
-
- it( 'Default sshould be overriden', () ->
- expect( filledModel.get( 'propertyOne' ) ).to.equal( 'This should be overriden now' )
- expect( filledModel.get( 'propertyTwo' ) ).to.equal( false )
- )
- )
-
- # Test a async function, could be your fetch for example ;-)
- #
- describe( 'async test', () ->
-
- it( 'it should return true', ( testCompleted ) ->
-
- emptyModel.exampleAsyncFunction( ( response ) ->
- expect( response ).to.be.a( 'boolean' )
- expect( response ).to.equal( true )
-
- testCompleted()
- )
- )
- )
-)
diff --git a/generators/demo/templates/test/unit/spec/models/example.spec.coffee b/generators/demo/templates/test/unit/spec/models/example.spec.coffee
new file mode 100644
index 00000000..6714bd5b
--- /dev/null
+++ b/generators/demo/templates/test/unit/spec/models/example.spec.coffee
@@ -0,0 +1,90 @@
+'use strict'
+
+ExampleModel = require( './../../../../src/models/example.coffee' )
+
+describe( 'An `ExampleModel` unit test suite', () ->
+
+ ## Create an instance without any data to test the defaults.
+ ##
+ emptyModel = new ExampleModel()
+
+ describe( 'A newly created model instance without an `attributes` argument', () ->
+
+ it( 'should have a default `attributeOne` attribute of type `String`', () ->
+ expect( emptyModel.get( 'attributeOne' )).toEqual( jasmine.any( String ))
+
+ return
+ )
+
+ it( 'should have a default `attributeTwo` attribute of type `Boolean`', () ->
+ expect( emptyModel.get( 'attributeTwo' )).toEqual( jasmine.any( Boolean ))
+
+ return
+ )
+
+ return
+ )
+
+ ## Test the set function by overwriting one of the defaults.
+ ##
+ describe( 'A default attribute, when set', () ->
+
+ it( 'should be overridden', () ->
+
+ newString = 'This should be overriden now'
+
+ emptyModel.set( 'attributeOne', newString )
+
+ expect( emptyModel.get( 'attributeOne' )).toEqual( newString )
+
+ return
+ )
+
+ return
+ )
+
+ ## Test model when xxx it data, check if defaults are overriden
+ ##
+ populatedModel =
+ new ExampleModel(
+
+ attributeOne: 'This should be overriden now'
+ attributeTwo: false
+ )
+
+ describe( 'A newly created model instance with a custom `attributes` argument', () ->
+
+ it( 'Should have been populated with the attributes as they were passed-in on its constructor', () ->
+
+ expect( populatedModel.get( 'attributeOne' )).toEqual( 'This should be overriden now' )
+ expect( populatedModel.get( 'attributeTwo' )).toEqual( false )
+
+ return
+ )
+
+ return
+ )
+
+ ## Test an async method.
+ ##
+ describe( 'A custom async method', () ->
+
+ it( 'it should return true', ( done ) ->
+
+ emptyModel.exampleAsyncFunction( ( response ) ->
+
+ expect( response ).toEqual( true )
+
+ done()
+
+ return
+ )
+
+ return
+ )
+
+ return
+ )
+
+ return
+)