Skip to content

Commit

Permalink
adding specs for the toString method on a new class
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiomcosta committed Mar 21, 2010
1 parent 654324c commit 9e6c8fa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions 1.3public/Class/Class.js
Expand Up @@ -24,6 +24,10 @@ var Animal = new Class({

say: function(){
return 'animal:say:' + this.name;
},

toString: function(){
return this.name;
}

});
Expand Down Expand Up @@ -206,8 +210,8 @@ describe('Class creation', {

value_of(spot.say()).should_be('NEW:animal:say:spot');
value_of(rover.say()).should_be('NEW:animal:say:rover');
}

},
//We might attempt to add support for the following at a later date

/*
Expand All @@ -234,6 +238,11 @@ describe('Class creation', {
value_of(rover.say()).should_be('NEW:animal:say:rover');
}
*/

"should overwrite the toString method": function(){
var animal = new Animal('dolphin');
value_of(animal + '').should_be('dolphin');
}

});

Expand Down

0 comments on commit 9e6c8fa

Please sign in to comment.