public
Description: Simple project setup to let you test jsunit, JSSpec and Screw Unit against the same javascript model classes.
Homepage: http://www.brokenbuild.com/blog
Clone URL: git://github.com/wesmaldonado/test-driven-javascript-example-application.git
wesmaldonado (author)
Mon Nov 17 09:57:57 -0800 2008
commit  5a92b0d3baf6e58a10da773ff5a1ad64090670c8
tree    042964d828de81b5677024288ae23dcbb29c403b
parent  b577564cdfa4910933942b2edcfff482a2bd0f93
100644 36 lines (27 sloc) 0.806 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require('/specs/spec_helper');
require('/implementations/cat');
 
var CatSpec = {
// example of setting up reusable before each
  'before each': function() {
Cat.prototype.meow = function(){ return "blah"; }
 
//console.log("before each was called");
  },
 
  // this is a subclass for your class.
  // subclass of the describe context
  describe: function(context, definition) {
    definition['before each'] = this['before each'];
    describe("Cat" + context, definition);
  }
};
 
CatSpec.describe(' my favorite cat', {
' should have a name': function(){
var cat = new Cat('fluffy');
value_of(cat.name).should_be('fluffy');
}
});
 
 
CatSpec.describe(' when meowing', {
    'should roar': function(){
var fluffy = new Cat('fluffy');
     value_of(fluffy.meow()).should_be("roar");
    }
});