I recently upgraded to Rails 5.1 from v4.3 and am now getting this error when running tests:
An error occurred while loading
./spec/controllers/admin/capac
In my case it was due to a git conflict message (the one like >>>> ... === ... <<<<) that I missed to resolve, so there was a syntax error when Rspec has been trying to load that class.
--fail-fast command line option does not help in this case as the error happens higher in the call stack, but you can see the actual error by just running any single spec file.