Skip to content

Instantly share code, notes, and snippets.

@sghiassy
Created November 26, 2017 20:56
Show Gist options
  • Save sghiassy/38f69de72c718a376854ca3e589fd59a to your computer and use it in GitHub Desktop.
Save sghiassy/38f69de72c718a376854ca3e589fd59a to your computer and use it in GitHub Desktop.
class Spec: QuickSpec {
override func spec() {
beforeSuite {
print("β˜•οΈ before suite")
}
afterSuite {
print("πŸ—‘ after suite")
}
describe("beforeEach and afterEach behaviour") {
beforeEach {
print("⭐️ top before each")
}
context("some context") {
beforeEach {
print("πŸ‘‰ context before suite")
}
it("example 1") { print("😊 example 1") }
it("example 2") { print("😊 example 2") }
it("example 3") { print("😊 example 3") }
beforeSuite {
print("🚨🚨🚨 before suite")
}
afterEach {
print("πŸ‘‰ context after each")
}
}
context("another context") {
beforeEach {
print("🍎 context before each")
}
it("example 1") { print("πŸ“ example 1") }
it("example 2") { print("πŸ“ example 2") }
afterEach {
print("🍎 context after each")
}
}
afterEach {
print("⭐️ top after each")
}
}
}
}
// OUTPUT
```
β˜•οΈ before suite
🚨🚨🚨 before suite
⭐️ top before each
🍎 context before each
πŸ“ example 1
🍎 context after each
⭐️ top after each
⭐️ top before each
🍎 context before each
πŸ“ example 2
🍎 context after each
⭐️ top after each
⭐️ top before each
πŸ‘‰ context before suite
😊 example 1
πŸ‘‰ context after each
⭐️ top after each
⭐️ top before each
πŸ‘‰ context before suite
😊 example 2
πŸ‘‰ context after each
⭐️ top after each
⭐️ top before each
πŸ‘‰ context before suite
😊 example 3
πŸ‘‰ context after each
⭐️ top after each
πŸ—‘ after suite
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment