Running Ruby tests with Spring from IntelliJ Idea / RubyMine
Mar 19, 2018 · 2 minute read · Commentsrubytools
IntelliJ Idea is my IDE of choice for all development across multiple languages. Support for different languages varies and improves at different rate but I find it useful most of the time.
Suddenly, last week my Ruby tests stopped running. Whenever I wanted any Ruby test to run, the execution failed with:
.../spring-2.0.2/lib/spring/sid.rb:39:in `getpgid': No such process (Errno::ESRCH)
I run Ruby tests with Spring preloader which has been the default for Rails applications for last few versions and Idea integrates nicely with it. Because I just updated Ruby, I suspected the issue was somehow related. I went through the basic steps of restarting IDE to make sure it picked up on the new gemset correctly, I checked if there were updates for Spring (there were none). Running the tests outside the IDE went just fine.
Bit of googling led me to a RubyMine issue. It is more than three years old and marked as fixed, so perfect, it must be some configuration thing!
Well kinda. I don’t really understand all the details but a suggestion in a comment by Dmitry Krasilkichov is what worked for me: set an environment variable in the Spring binstub:
ENV['SPRING_SERVER_COMMAND'] = "spring server"
I’m happy it worked but it’s half an hour down the drain. Idea looks like it works with Spring and provides only a drop down to select a preloader, no extra config, but this issue is not documented for some reason.
P. S. I tried the basic setup with the previous Ruby version and didn’t work any more so I have no idea how I could have not encountered this earlier.
We're looking for developers to help us save energy
If you're interested in what we do and you would like to help us save energy, drop us a line at jobs@enectiva.cz.