[Context] Convenience push with block function

This commit is contained in:
Kyle Fuller
2015-10-24 17:27:02 -07:00
parent 19366ec71b
commit 9b26b7d71a
2 changed files with 20 additions and 0 deletions

View File

@@ -50,4 +50,16 @@ describe("Context") {
context.push(["name": "Katie"])
try expect(context["name"] as? String) == "Katie"
}
$0.it("allows you to push a dictionary and run a closure then restoring previous state") {
var didRun = false
try context.push(["name": "Katie"]) {
didRun = true
try expect(context["name"] as? String) == "Katie"
}
try expect(didRun).to.beTrue()
try expect(context["name"] as? String) == "Kyle"
}
}