Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

ruby on rails - Tests do not run when file changes with Guard and rspec on windows

I've installed the guard-rspec gem for use in my rails application. When I start up guard from the command line via bundle exec guard, it runs my entire test suite the first time with no problem.

However, any time I make any changes to a spec file or any watched files as specified in my Guardfile, Guard doesn't seem to recognize the changes and no tests are rerun.

I even tried putting something every explicit in my Guardfile like this:

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

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

Has anyone had any luck running Guard on windows or encountered a similar problem?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I'm not a Windows user and this is not from my personal experience, but as a Guard maintainer I often hear that the fchange gem has its problems. You can force Guard polling for changes and thus skip fchange with:

bundle exec guard -p

Maher Sallam has addressed this issue and created wdm, which seems to be more reliable. There's also a pull request for integrate it into Guard. I recommend you to test the integration and give Maher some feedback from a real world Windows user, since Maher is a Linux guy :P


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...