Skip to content
Browse files

Update example with after callbacks

  • Loading branch information...
1 parent 8739e83 commit f32eb2cee82bbdc1641c87579e2abe7b6f727f39 @joshuaclayton committed
Showing with 11 additions and 1 deletion.
  1. +11 −1 README.markdown
View
12 README.markdown
@@ -9,16 +9,22 @@ I don't have the patience to write my own JS testing framework so I figured I'd
## Example
describe("SpecIt", function() {
- var john;
+ var john, cachedItems = [];
before(function() {
john = {name: "John Doe", age: 26};
});
+ after(function() {
+ cachedItems = [];
+ });
+
it("should match on inclusion", function() {
[1, 2].should(include, 1, 2);
({one: 1, two: 2}).should(include, "one");
"string".should(include, "str");
+ cachedItems.push(1);
+ cachedItems.should(include, 1);
});
it("should match by type comparison", function() {
@@ -37,6 +43,10 @@ I don't have the patience to write my own JS testing framework so I figured I'd
john.name.should(eql, "John Doe");
john.age.should(beLessThan, 30);
});
+
+ it("should run after callbacks", function() {
+ cachedItems.should(beSimilarTo, []);
+ });
});
## Supported Matchers

0 comments on commit f32eb2c

Please sign in to comment.
Something went wrong with that request. Please try again.