Question

I've been playing around with autotest trying to make it work all day.. but am having some problems...

I've been following https://github.com/rspec/rspec/wiki/autotest, I'm running with:

  • Ruby 1.9.3-p194
  • rspec 2.10.0
  • ZenTest 4.8.1

I also created a .rspec file.

So with this setup, I run autotest, and it works - my test runs, it passes, hooray!. When I stick a failure into my test e.g. false.should == true, then the test starts looping, over and over again.

what happens is that it's an integration test, and I'm writing to an sqlite db. If I run find . -mmin -1 then I'm able to see that my db folder has changed - so I figured this is the problem.

So I edit .autotest and add the following:

Autotest.add_hook :initialize do |autotest|
  %w{db}.each { |exception| autotest.add_exception(exception) }
  false
end

But now when I run autotest, it just says the following:

loading autotest/rspec2

and that's it, it won't do anything anymore. Previously the output was:

loading autotest/rspec2

/home/me/.rbenv/versions/1.9.3-p194/bin/ruby -rrubygems -S '/home/me/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/rspec-core-2.10.1/exe/rspec' ``--tty '/home/me/Workspace/myproject/spec/integration/db/lead_spec.rb'

and then it'd run my test and show the result...

Anyone know what could be going on? it's very frustrating, and I feel like I've come to a road block....

Thanks for your help!

Était-ce utile?

La solution

Autotest checks if defined exceptions match any part of the filename. Your spec has db in it's path so it is ignored by autotest.

If you want to ignore db folder, then do the following:

Autotest.add_hook :initialize do |a|
  a.add_exception %r{^\./db}
end
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top