Skip to content

Instantly share code, notes, and snippets.

@sdepold
Created June 10, 2010 13:07
Show Gist options
  • Save sdepold/432965 to your computer and use it in GitHub Desktop.
Save sdepold/432965 to your computer and use it in GitHub Desktop.
describe("before", function() {
before(function() {
var hash = {a: 1}
var foo = "a"
})
it("should correctly use before", function() {
expect(hash).toMatch({a: 1}) // will be true
hash.a = 2
expect(hash).toMatch({a: 2}) // will be true
})
it("should have a new hash instance", function() {
expect(hash).toMatch({a: 1}) // will be true
})
})
describe("after", function() {
after(function() {
expect(toBeTested).toEqual(1)
})
it("should succeed", function() {
var toBeTested = 1 // will be true in the after filter
})
it("should fail", function() {
var toBeTested = 2 // will fail in the after filter
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment