Forum: RSpec autotest?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2a39aed820c125e6db9826fa8180043f?d=identicon&s=25 Denis Haskin (dwhsix)
on 2009-05-20 04:55
(Received via mailing list)
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
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-05-20 05:22
(Received via mailing list)
Denis Haskin 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
2a39aed820c125e6db9826fa8180043f?d=identicon&s=25 Denis Haskin (dwhsix)
on 2009-05-20 05:41
(Received via mailing list)
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
369b9fd2a0d9e7cdbc60907a2a056ad9?d=identicon&s=25 Scott Taylor (Guest)
on 2009-05-20 06:26
(Received via mailing list)
Denis Haskin wrote:
> dwh
>
What version of the ZenTest gem do you have?
2a39aed820c125e6db9826fa8180043f?d=identicon&s=25 Denis Haskin (dwhsix)
on 2009-05-20 12:48
(Received via mailing list)
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
369b9fd2a0d9e7cdbc60907a2a056ad9?d=identicon&s=25 Scott Taylor (Guest)
on 2009-05-20 15:02
(Received via mailing list)
Denis Haskin 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
2a39aed820c125e6db9826fa8180043f?d=identicon&s=25 Denis Haskin (dwhsix)
on 2009-05-21 07:31
(Received via mailing list)
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
369b9fd2a0d9e7cdbc60907a2a056ad9?d=identicon&s=25 Scott Taylor (Guest)
on 2009-05-21 08:22
(Received via mailing list)
Denis Haskin 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
C6ce9a98479a04c47d143d444ae317c6?d=identicon&s=25 Kero van Gelder (Guest)
on 2009-05-21 09:20
(Received via mailing list)
> 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/test*rb)
  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 ;)

Bye,
Kero.

___
How can I change the world if I can't even change myself?
  -- Faithless, Salva Mea
C6ce9a98479a04c47d143d444ae317c6?d=identicon&s=25 Kero van Gelder (Guest)
on 2009-05-21 10:00
(Received via mailing list)
> > 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 ;)

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
2a39aed820c125e6db9826fa8180043f?d=identicon&s=25 Denis Haskin (dwhsix)
on 2009-05-21 12:44
(Received via mailing list)
Cool. Scott, Kero -- thanks.

dwh
5d38ab152e1e3e219512a9859fcd93af?d=identicon&s=25 David Chelimsky (Guest)
on 2009-05-21 13:24
(Received via mailing list)
On Thu, May 21, 2009 at 2:27 AM, Kero van Gelder <kero@chello.nl> 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 ;)
>
> 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
369b9fd2a0d9e7cdbc60907a2a056ad9?d=identicon&s=25 Scott Taylor (Guest)
on 2009-05-21 16:11
(Received via mailing list)
Kero van Gelder wrote:
>    http://wiki.github.com/dchelimsky/rspec/autotest-integration
>

+1.

Thanks Kero.

Scott
C6ce9a98479a04c47d143d444ae317c6?d=identicon&s=25 Kero van Gelder (Guest)
on 2009-05-21 17:49
(Received via mailing list)
> >> > 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 ;)
> >
> > 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
5d38ab152e1e3e219512a9859fcd93af?d=identicon&s=25 David Chelimsky (Guest)
on 2009-05-21 18:25
(Received via mailing list)
On Thu, May 21, 2009 at 10:34 AM, Kero van Gelder <kero@chello.nl>
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
This topic is locked and can not be replied to.