Autotest?

Can someone point me to some decent doc on autotest? Everything I’m
finding seems either pretty old, or says “autotest and rspec work out of
the box”, which it isn’t for me…

I installed the grosser-autotest gem (just guessing) and when I run
autotest it only runs (legacy) test/unit tests.

Suggestions?

Thanks…

dwh

Denis H. wrote:

Can someone point me to some decent doc on autotest? Everything I’m
finding seems either pretty old, or says “autotest and rspec work out
of the box”, which it isn’t for me…

I installed the grosser-autotest gem (just guessing) and when I run
autotest it only runs (legacy) test/unit tests.

Suggestions?
RSpec now ships with an autospec command that acts as a wrapper… are
you using it?

-Ben

Hmm. Okay, tried that but:

$ autospec
(Not running features. To run features in autotest, set
AUTOFEATURE=true.)
loading autotest/rails_rspec
Autotest style autotest/rails_rspec doesn’t seem to exist. Aborting.

I’m running my rails rspec examples just fine manually…

dwh

Denis H. wrote:

dwh

What version of the ZenTest gem do you have?

Denis H. wrote:

I didn’t have ZenTest installed. I just did, but I still get the same
error. Should I not have grosser-autotest installed?

$ gem list | grep -i test
grosser-autotest (4.0.4)
test-unit (2.0.2)
ZenTest (4.0.0)
Try removing it.

Make sure to grab the latest ZenTest (which you now have), and rspec
(and rspec-on-rails, if you are in a rails project).

Aslak used to have some good abbreviation for this phrase: what versions
of everything are you using?

  • rspec
  • rspec on rails (if in a rails project)
  • rails (if in a rails project)
  • OS

Scott

Thanks. Ok – removing grosser-autotest lets autotest run, but it’s
only running my unit tests, not rspec:

$ autotest
(Not running features. To run features in autotest, set
AUTOFEATURE=true.)
loading autotest/rails
/usr/bin/ruby1.8 -I.:lib:test -rubygems -e “%w[test/unit
test/unit/design_test.rb test/functional/admin/user_controller_test.rb
test/unit/helpers/admin/user_helper_test.rb test/unit/garment_test.rb
test/functional/admin/admin_controller_test.rb
test/unit/helpers/admin/admin_helper_test.rb].each { |f| require f }” |
unit_diff -u

Here’s all my versions:

cucumber (0.3.3)
rails (2.3.2, 2.2.2)
rspec (1.2.6, 1.1.12)
rspec-rails (1.2.6)
ZenTest (4.0.0)

OS: Ubuntu 8.10

I was missing rspec-rails, but even after installing it, same result
as above.

Is there some configuration I need to do to get rid of unit/functional
tests and only run rspec+cucumber?

Thanks!

dwh

I didn’t have ZenTest installed. I just did, but I still get the same
error. Should I not have grosser-autotest installed?

$ gem list | grep -i test
grosser-autotest (4.0.4)
test-unit (2.0.2)
ZenTest (4.0.0)

dwh

Denis H. wrote:

test/functional/admin/admin_controller_test.rb

OS: Ubuntu 8.10

I was missing rspec-rails, but even after installing it, same result
as above.

Is there some configuration I need to do to get rid of unit/functional
tests and only run rspec+cucumber?

Run “autospec”, which should come with the latest rspec gem.

Scott

Is there some configuration I need to do to get rid of unit/functional
tests and only run rspec+cucumber?

This eplains all there is to explain (though terse and not from
your use case)
http://zentest.rubyforge.org/ZenTest/Autotest.html

and you now have to add code from that to your .autotest

If you want to clear existing mappings, and add new mappings,
while also ignoring any temp file created by cucumber (or autotest
will keep triggering because it saw an updated file; which
surprises me, as there is no mapping for those files…)
you get something like this:

Autotest.add_hook(:initialize) {|at|
at.add_exception %r{^.git}
at.add_exception %r{^./tmp}
at.clear_mappings # take out the default (test/testrb)
at.add_mapping(%r{^lib/.
.rb$}) {|filename, _|
Dir[‘spec/**/*.rb’]
}
nil
}

The nil make sure that other :initialize hooks get executed.
Very relevant if you have both ~/.autotest and .autotest

I guess I should add this in some form to the rspec wiki :wink:

Bye,
Kero.


How can I change the world if I can’t even change myself?
– Faithless, Salva Mea

Is there some configuration I need to do to get rid of unit/functional
tests and only run rspec+cucumber?

[…]

I guess I should add this in some form to the rspec wiki :wink:

Done:
http://wiki.github.com/dchelimsky/rspec/autotest-integration

Bye,
Kero.


How can I change the world if I can’t even change myself?
– Faithless, Salva Mea

Cool. Scott, Kero – thanks.

dwh

On Thu, May 21, 2009 at 2:27 AM, Kero van Gelder [email protected] wrote:

Is there some configuration I need to do to get rid of unit/functional
tests and only run rspec+cucumber?

[…]

I guess I should add this in some form to the rspec wiki :wink:

Done:
http://wiki.github.com/dchelimsky/rspec/autotest-integration

Thanks Kero. I added a bit of information about autospec to that wiki
page.

Cheers,
David

Is there some configuration I need to do to get rid of unit/functional
tests and only run rspec+cucumber?

[…]

I guess I should add this in some form to the rspec wiki :wink:

Done:
http://wiki.github.com/dchelimsky/rspec/autotest-integration

Thanks Kero. I added a bit of information about autospec to that wiki page.

I keep learning things…
add_mapping returns nil, that’s why it works for autotest/rspec.rb

But I’ve ran strace to confirm the problem I had with non-nil myself:
~/.autotest is ran before ./.autotest on my system (debian unstable).
Are you sure it’s the other way around on your system?
I haven’t seen autospec docs that claim one or the other.

Bye,
Kero.


How can I change the world if I can’t even change myself?
– Faithless, Salva Mea

Kero van Gelder wrote:

http://wiki.github.com/dchelimsky/rspec/autotest-integration

+1.

Thanks Kero.

Scott

On Thu, May 21, 2009 at 10:34 AM, Kero van Gelder [email protected]
wrote:

I keep learning things…
add_mapping returns nil, that’s why it works for autotest/rspec.rb

But I’ve ran strace to confirm the problem I had with non-nil myself:
~/.autotest is ran before ./.autotest on my system (debian unstable).
Are you sure it’s the other way around on your system?
I haven’t seen autospec docs that claim one or the other.

No - you’re correct - I had it wrong- and what you’re experiencing
makes more sense. The local .autotest should load after the global
~/.autotest so it can do app-specific stuff.

I’ll update the wiki page as soon as I can load it (having trouble
reaching github this moment).

Cheers,
David