Guard and Capybara's save_and_open_page
14 Aug 2013
I noticed a problem while running Guard where it would appear to malfunction and become unresponsive. The tests would still run or at least complete (according to growl), but I wouldn’t see errors and the guard prompt would never return. I wasn’t sure quite why this was happening. Here’s a sample of what would come up:
It would hang here indefinitely, but would apparently still be working because it would run tests on save (growl notified me). It wasn’t clear initially that this was due to me using Capybara’s save_and_open_page but I am fairly convinced that this is why. Here is my relevant installed gems:
The SO gives the answer, but isn’t quite clear about where the solution should go. Also, it includes the STDOUT, STDERR line which I omitted because it doesn’t appear to actually fix the issue and instead generates a bunch of constant overwriting warnings. So, add this to “spec_helper” in your spec directory:
And guard will now function happily. As a final note, you can put this before and after blocks in your individual test files (where you use save_and_open_page) if you want to reduce the theoretical overhead of doing this on every test.