Created
April 9, 2009 06:23
-
-
Save tj/92283 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// --- Screw.Unit | |
describe('Person', function(){ | |
var person | |
before(function(){ | |
person = new Person | |
}) | |
describe('.addPet', function(){ | |
it('should add pets', function(){ | |
person.addPet('foo').addPet('bar') | |
expect(person.pets.length).to(equal, 2) | |
}) | |
}) | |
}) | |
// --- jsUnitTest | |
new Test.Unit.Runner({ | |
setup : function(){ | |
this.person = new Person | |
}, | |
// no nesting ? ... | |
testPersonAddPet : function(){ | |
this.person.addPet('foo').addPet('bar') | |
assertEqual(2, this.person.pets.length) | |
} | |
}) | |
// --- YUI Test | |
test = new YAHOO.tool.TestCase({ | |
name: "Person", | |
setUp : function () { | |
this.person = new Person | |
}, | |
testAddPet: function () { | |
Assert = YAHOO.util.Assert | |
this.person.addPet('foo').addPet('bar') | |
Assert.areEqual(2, this.person.pets.length) | |
}, | |
}); | |
// --- JSpec | |
describe 'Person' | |
before | |
person = new Person | |
end | |
describe '.addPet' | |
it 'should add pets' | |
person.addPet('foo').addPet('bar') | |
person.should.have 2, 'pets' | |
end | |
end | |
end | |
// OR with grammar-less option | |
describe('Person', function(){ | |
before(function(){ | |
person = new Person | |
}) | |
describe('.addPet', function(){ | |
it ('should add pets', function(){ | |
person.addPet('foo').addPet('bar') | |
expect(person).to(have, 2, 'pets') | |
}) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment