1

My RSpec examples were running respectably until I migrated to a new Mac. Now, it seems the 1st test will take 1-3 minutes. The next time the tests are run (in a different order) that same test might take only 0.2 seconds.

rspec -p will show me which examples are slow that round but it doesn't help me debug WHY.

It might be a call to an outside service or, perhaps some external volume that's timing out because it's no longer attached to this machine, but I can't think of what or where the reference might be... other teammates testing same codebase don't have this problem.

Thoughts?

Edit (adding image of profiling results)

Does this help? I have no idea what cycle 5 means...

enter image description here

Meltemi
  • 37,979
  • 50
  • 195
  • 293
  • 1
    This is an old blog post, but check out https://www.coffeepowered.net/2012/10/23/profiling-rspec-2-examples/ - you can adapt that technique to RSpec 3 if you're using it. For the record, my unsubstantiated gut guess is DNS timeouts. :) – Chris Heald Jan 15 '15 at 21:07
  • I tried that and was able to get some data (see image) but I'm not sure how to decipher this... – Meltemi Jan 16 '15 at 01:53
  • The first test is the one where it loads the rails environment. No idea how to fix: try changing from webrick to something else? (puma/unicorn etc) just to see if it persists? – Taryn East Jan 16 '15 at 03:53
  • It looks like it's spinning up Capybara, which is going to have some overhead. It may be that your assets are being compiled during that run; try turning off cycle detection. – Chris Heald Jan 16 '15 at 07:16
  • Just looking at this project again. Sorry, but what's "cycle detection"? – Meltemi Jan 29 '15 at 19:32

0 Answers0