On Tue, Jun 21, 2011 at 8:13 AM, Sidu Ponnappa <ckponna...@gmail.com> wrote: > I'm cross posting a query on timing out tests that came up on our local ruby > list: > >> In RSpec1, there was an option "timeout" using which we can fail all >> the long running tests i.e. "spec --timeout 2 spec/" will fail those >> tests which takes more than 2 seconds to run. It does not seem to be >> existing in RSpec2. I saw the "filter_run" option as mentioned here: >> http://blog.davidchelimsky.net/2010/06/14/filtering-examples-in-rspec-2/. >> Using this I can add "slow" tags to tests. But it is not same as the >> "timeout" option. Can someone let me know whats the better approach to >> time out slow running tests? > > Any suggestions would be appreciated.
What about an around_filter? require 'timeout' RSpec.configure do |c| c.around(:each) do |example| Timeout::timeout(2) { example.run } end end http://relishapp.com/rspec/rspec-core/v/2-0/dir/hooks/around-hooks _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users