-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When Using Spring, Specs Won't Run Unless rspec Has Been Installed as a Spring Command #128
base: master
Are you sure you want to change the base?
Conversation
@@ -583,6 +583,7 @@ file if it exists, or sensible defaults otherwise." | |||
|
|||
(defun rspec-spring-p () | |||
(and rspec-use-spring-when-possible | |||
(not (equal (getenv "SPRING_DISABLE") "1")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't it be set to a different non-empty value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be set to anything. How about I do this:
(member (getenv "SPRING_DISABLE") '(nil "" "0"))
Or this:
(or
(null (getenv "SPRING_DISABLE"))
(equal "" (getenv "SPRING_DISABLE"))
(equal "0" (getenv "SPRING_DISABLE")))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But where do we stop, should we also check for "false"
, "off"
, etc..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does 0
mean "not disable"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose so, then. Check all three of these possible values, using member
.
It's doesn't seem like false
, etc, should be treated similarly: https://github.com/rails/spring/blob/7efd492018049df43310feb89acbaf226446a123/lib/spring/binstub.rb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And please fix the name of the variable (words in wrong order).
Maybe you had a .pid file left over? See |
Sure, though have you considered using |
|
Ah of course, a process object... 💨 |
There's always |
Hmm, actually, since setting this var makes Spring not do anything, why bother with it on our end? |
If Spring's pid file is there but Spring is not running, then I can modify. |
Please clarify: this is unrelated to What exactly happens? "Spring gets used" or "specs don't run"? |
Yes
I don't normally use Spring so it was not obvious at first, but after doing some research it turns out that it fails when spring is running because
You can only call |
Ok. Do you think |
The mode performs several checks in an effort to find the right option. It finds Maybe something like this: (defun rspec-spring-p ()
(and rspec-use-spring-when-possible
(stuff-that-looks-up-spring-pid-file)
(not (cl-notany (lambda (s) (string-match "^\s+rspec\s" s)) (process-lines "spring" "help"))))) |
|
Is saving 0.5 seconds worth the bug? |
Why not? And if Spring is installed, not running specs through it is unlikely to be what the user wants. Rather, they want to be notified that That could be done with a message at the bottom of the compilation buffer. Like |
(sigh) okay, let's agree that it is worth the bug.
Maybe, maybe not. Is this what your experience has shown? Over the past 24 hours here are the problems I've had with spring + rspec:
Certainly not a bad approach but, as you've said, it assumes that those using spring + rspec |
Not really. I haven't used Rails for quite a while, so I haven't used Spring either. But you're the first to complain about it here.
Why else would they be running Spring? But anyway, they can avoid it by setting
That's normal. IIRC, Spring performs bundle setup by itself. |
FWIW I also ran into this issue and after pondering and poking around at this for a little while, I realized that nobody on my team knows what spring is or what it's for. It was just cargo-culted in from What we do know about and use is So I propose that this is a problem with rspec-rails, which should recognize that rails is distributing spring and that there's an integration necessary for full functionality: Edit: the maintainer politely responded and closed as you can see:
|
This adds a check for the
SPRING_DISABLE
environment variable.Also note that even though Spring was not running it still tried to execute
spring rspec ...
. This resulted in Spring's usage.