[rspec-devel] Autotest + Rails + HEAD/trunk Rspec

Scott Taylor mailing_lists at railsnewbie.com
Fri Aug 10 15:14:22 EDT 2007


On Aug 10, 2007, at 7:58 AM, David Chelimsky wrote:

> On 8/10/07, Scott Taylor <mailing_lists at railsnewbie.com> wrote:
>>
>> David,
>>
>> I believe you authored the plugin for autotest integration (unless it
>> was Aslak - my apologies then).  Could you give me a hint on how
>> Autotest ends up using the spec command in script/spec instead of the
>> one installed in gems?  Or is this a current bug?
>
> When autotest starts it looks on the path for any file named
> autotest/discover.rb. The one in rspec core tells autotest that if it
> can find a spec directory that it must be rspec. It already knows that
> if it finds config/environment that it must be rails (that's the
> assumption made directly by autotest). It then adds words to a list:
> rspec, rails, camping, etc - depending on what it learns from the
> autotest/discover files and what it discovers.
>
> So in the case of an rspec project, it then looks for a file named
> autotest/rspec.rb, which it finds in rspec core. In the case of an
> rspec/rails project it looks for a file named autotest/rails_rspec.rb,
> which it finds in the rspec_on_rails plugin. These two different files
> define two different spec commands. In fact, the one in trunk in core
> now generates "ruby bin/spec" if it finds "bin/spec", otherwise it
> generates "ruby spec" - that supports using autotest to work on rspec
> directly.
>

Oops.  I should have looked over that part of the autotest class  
again before I sent an email.  I hadn't seen this line:

$:.push(*Dir["vendor/plugins/*/lib"])

I also didn't think that the main part of the Autotest class would  
search vendor/plugins.  I guess rails is considered "the only Ruby app".

Scott






More information about the rspec-devel mailing list