Created
May 27, 2009 03:26
-
-
Save jashkenas/118443 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
describe("The array [1,2,3]", function() { | |
before(function() { | |
ary = [1,2,3]; | |
}); | |
should('not be empty', function() { | |
ary.length.should().not().be(0); | |
ary.indexOf(1).should().be(0); | |
}); | |
should("be three elements long", function() { | |
ary.length.should().be().equal(3); | |
ary.length.should().be().close(3, 0.1); | |
}); | |
should("be retrievable by index", function() { | |
ary[1].should().be(2); | |
}); | |
should("have its own array identity", function() { | |
ary.constructor.should().be().an(Array); | |
ary.should().not().be().equal([1,2,3]); | |
}); | |
should("only have methods that really exist", function() { | |
ary.should().error().undefinedMethod(); | |
ary.should().not().error().push(1); | |
}); | |
}) | |
// Produces: | |
The array [1,2,3] | |
- should not be empty | |
- should be three elements long | |
- should be retrievable by index | |
- should have its own array identity | |
- should only have methods that really exist | |
5 specifications (9 requirements), 0 failures, 0 errors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment