Olivine-Labs/busted — pull request #183 by lipp (2013-06-26 10:12:38+00:00)
Title: add finally call

Adds the `finally` call (loop independent).

Can be used for cleanups after test where `after` is unsuitable.

```lua
it('provide dummy stuff and clean up',function()
local f = io.popen('stupid_process')
-- ensure that once test has finished f:close() is called
-- independent of test outcome
finally(function() f:close() end)
... -- do some stuff involving f
end)
```

The same behavior could be accomplished with describe / before / after, but this would bloat code alot and more "distant" upvalues (`f`) would be required:

```lua
describe('when using dummy stuff',function()
local f
before(function()
f = io.popen('stupid_process')
end)

after(function()
f:close()
end)

it('do stuff with f',function()
...
end)
end)
```