[rspec-users] Blog post on building an around(:all) hook using fibers

Myron Marston myron.marston at gmail.com
Fri Mar 9 15:39:35 UTC 2012


RSpec provides an around(:each) hook but no around(:all) hook.  I realized 
recently that you can build an around hook out of separate before/after 
hooks using fibers, and decided to blog about it [1], using an around(:all) 
hook as the example.  Some of you may find it interesting or even 
potentially useful.  There's a microgem available as a gist [2] as well.  
Note that I'll probably never use this gem and the :all hooks may be going 
away at some point [3], so use at your own risk.  It's more of a 
proof-of-concept and a fun exercise than anything else.

Myron

[1] 
http://myronmars.to/n/dev-blog/2012/03/building-an-around-hook-using-fibers
[2] https://gist.github.com/2005175
[3] https://github.com/rspec/rspec-core/issues/573
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120309/03dcb1ce/attachment.html>


More information about the rspec-users mailing list