I installed RSpec in an application, and when I ran the test code, I got an error. No matter how many times I review it, there should be no problem with the settings and description, but why doesn't it work? ..
** The cause was a gem called "spring". ** ** I entered the following command in the app directory and ran the test code again and it worked fine. Was good.
mac@ myApp % spring stop
Spring stopped.← OK if this notation appears
By the way, don't worry, this spring will restart automatically when you enter the rails command.
Simply put, it's like a rails cache. It is installed by default in Gemfile when rails new.
In this case, the cache before the introduction of RSpec happens to remain, If you execute the test code in that state, it seems that you get an error saying "RSpec cannot be used".
By the way, to check the status of spring, you can check it like this.
mac@ myApp % spring status
Spring is running:
97404 spring server | myApp | started 10 secs ago
97405 spring app | myApp | started 10 secs ago | development mode
If you enter in the order of spring stop
→ rails c
→ ʻexit→
spring status`, it will look like this.
mac@ myApp % spring stop
Spring stopped.
mac@ myApp % rails c
Running via Spring preloader in process 97418
Loading development environment (Rails 6.0.3.2)
irb(main):001:0> exit
mac@ myApp % spring status
Spring is running:
97404 spring server | myApp | started 10 secs ago
97405 spring app | myApp | started 10 secs ago | development mode
mac@ ps aux | grep spring
mac 97139 101.0 0.5 4370124 43216 ?? Rs 2:24AM 0:00.73 spring app | myApp3 | started 0 secs ago | development mode
mac 97106 0.2 0.3 4352516 24104 s002 S 2:24AM 0:00.42 spring server | myApp3 | started 39 secs ago
mac 96929 0.0 1.2 4462288 100216 ?? Ss 2:20AM 0:03.23 spring app | myApp2 | started 4 mins ago | development mode
mac 77394 0.0 0.1 4352516 8816 ?? S 05PM 0:01.03 spring server | myApp2 | started 56 hours ago
mac 4764 0.0 0.0 4486444 472 ?? Ss 5 720 1:18.61 spring app | myApp1 | started 439 hours ago | development mode
mac 4760 0.0 0.0 4351492 432 ?? S 5 720 0:01.58 spring server | myApp1 | started 439 hours ago
mac 97142 0.0 0.0 4276476 696 s002 S+ 2:24AM 0:00.00 grep spring
I wondered if I could stop it with the kill command, but I couldn't stop it because it was restored immediately.
After all it seems better to move to the corresponding directory and obediently spring stop
.
Recommended Posts