RSpec 2 autotest file

Hi

I’ve tried using the autotest file from RSpec 2 (lib/autotest/rspec2.rb)
but I’ve found a problem with it, that I think is a bug.

The file contains two sections

  • an Autotest Autotest.add_hook :initialize block
  • an Autotest class “Autotest::Rspec2”

In one project I’m working on, the code in Autotest::Rspec2 is really
useful to me, but the :initialize hook contains setup that interferes
with my project structure (I don’t want a “lib” folder.

Unfortunately, it appears that Autotest’s clear_mappings can’t stop
the :initialize mappings making it into the final setup. This means
that to use Autotest::Rspec2, I’ve had to copy-paste the contents into
my own autotest file, rather than subclassing.

Is this a bug? (ie, is there no workaround for the coupling between the
two blocks?) If so, can it be fixed?

Alternatively (or as well), is it time to drop autotest and use watchr
instead? I noticed RSpec 2 uses that, and it seems really fast and
simple, both of which go down very well with me…

Any thoughts?

Cheers
Ash


http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran

On Aug 7, 2010, at 4:54 PM, Ashley M. wrote:

Unfortunately, it appears that Autotest’s clear_mappings can’t stop the :initialize mappings making it into the final setup. This means that to use Autotest::Rspec2, I’ve had to copy-paste the contents into my own autotest file, rather than subclassing.

Is this a bug?

Yes.

(ie, is there no workaround for the coupling between the two blocks?) If so, can it be fixed?

Yes:

Alternatively (or as well), is it time to drop autotest and use watchr instead? I noticed RSpec 2 uses that, and it seems really fast and simple, both of which go down very well with me…

I don’t think we need to drop one to use the other :slight_smile:

Cheers,
David

On Aug 08, 2010, at 12:00 am, David C. wrote:

Yes: Set up autotest mappings in the initialize method instead of the · rspec/rspec-core@c2e8a39 · GitHub

Cool, ta :slight_smile: I’ll update my code shortly.

Cheers
Ash


http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran