Tests are not executed when changing a file using Guard and rspec in windows

I installed the guard-rspec gem for use in my rails application. When I start protection from the command line through bundle exec guard , it starts the whole test package for the first time without problems.

However, whenever I make any changes to the spec file or any files viewed as indicated in my Guardfile, the Guard does not seem to recognize the changes, and no tests are repeated.

I even tried putting something explicit in my Guardfile as follows:

 watch("app/views/orders/new.html.erb") { "spec/requests/orders_spec.rb" } 

which should run my orders_spec.rb test to run when I edit and save new.html.erb correctly? Well, when I edit it and click save, nothing happens, not even an error or warning.

Has anyone managed to run Guard on Windows or run into a similar problem?

+7
source share
2 answers

I am not a Windows user, and this is not from my personal experience, but as a guardian of the guard, I often hear that the fchange gem has its own problems, you can force a Guard to poll for changes and thus skip fchange with:

bundle exec guard -p

Maher Sallam examined this problem and created wdm , which seems to be more reliable. There is also a pull request for integration into the Guard. I recommend that you test the integration and give Maher some feedback from a real Windows user, since Maher is a Linux guy: P

+9
source

I had this problem (but on Mac). I had a specification for a service class, and when I saved the specification, tests were performed carefully, but when I saved the service class, the corresponding specification did not start. Only this class has been affected. It turns out that there was a typo in my specification file name that did not match the class file name. If your specification is not met while saving, make sure your file names are correct.

+1
source

Source: https://habr.com/ru/post/921884/


All Articles