I know there are a few questions already regarding autotest and zentest but my problem seems a little different. In my case, if I run with
autotest
nothing happens other than a status message saying "Waiting since..." with no tests being run. If I run it with
autotest -s rspec2
Then all my tests run. If I change a spec file autotest knows and re-runs my tests. But if I change a controller file then I just get my "Waiting since..." message updated but no tests are run.
Any ideas what's going on? Or can someone please poin开发者_如何学编程t me where I can look into this further?
.autotest (i actually don't know if # is how to comment out a section!)
require 'autotest/fsevent'
#require 'autotest/restart'
require 'autotest/growl'
require 'autotest/timestamp'
I never use "sudo gem install" because I am using rvm. So only "gem install X"
Your problem looks very much similar to this autotest on ubuntu does nothing
The only gem you need is autotest
, so deinstall the rest. Optionally, you can use autotest-fsevent
and autotest-growl
on a mac.
Make sure there is an autotest/discover.rb
with the following contents:
Autotest.add_discovery { "rails" }
Autotest.add_discovery { "rspec2" }
It should've been generated by rails generate rspec:install
If you have additional directories in your app directory, you add them to autotest by making a .autotest
file, containing something like:
Autotest.add_hook :initialize do |at|
at.add_mapping(%r%^spec/(.*)_spec\.rb$%) { |filename, _| filename }
at.add_mapping(%r%^app/(.*)\.rb$%) { |_, m| ["spec/#{m[1]}_spec.rb"] }
end
(Answer based on Rails3 and RSpec2)
精彩评论