guard / guard-rspec

Guard::RSpec automatically run your specs (much like autotest)
https://rubygems.org/gems/guard-rspec
MIT License
1.31k stars 241 forks source link

'Guard::RSpec cannot open results file' when SPEC_OPTS has been set #418

Open Jamedjo opened 5 years ago

Jamedjo commented 5 years ago

Problem

Related to https://github.com/guard/guard-rspec/issues/348, https://github.com/guard/guard-rspec/issues/326 and https://github.com/guard/guard-rspec/issues/348

I was unable have guard detect more that one change because Guard was terminating the runner with Guard::RSpec has just been fired every time. I eventually worked out this was due to the SPEC_OPTS environment variable having been set in our docker container.

Possible solutions

First I think we should catch this error and show a warning instead of terminating, since it has been a problem in the past with multiple causes and prevents the use of this library.

To solve this particular cause we could unset the SPEC_OPS variable when spawning the new process.

Error

11:44:51 - ERROR - Guard::RSpec cannot open results file: "/home/git/gitlab/tmp/rspec_guard_result". This is likely a bugso please report this at http://github.com/guard/guard-rspec/issues/new along with as muchinformation as possible to reproduce this issue.
11:44:51 - ERROR - Guard::RSpec failed to achieve its <run_on_modifications>, exception was:
> [#] Errno::ENOENT: No such file or directory @ rb_sysopen - /home/git/gitlab/tmp/rspec_guard_result
> [#] /data/cache/bundle-2.5/gems/guard-rspec-4.7.3/lib/guard/rspec/results.rb:11:in `readlines'