[rspec-users] Including extra directories for Autospec

Adam Anderson adamandersonis at gmail.com
Sun May 17 19:24:49 EDT 2009

I'm really not sure what I'm doing wrong so I tried started from
scratch still with no positive results.

Here's my setup:
rails 2.3.2
rspec 1.2.6
rspec-rails 1.2.6
ZenTest 4.0.0

Here's what I did:
$ rails foo
$ cd foo
$ ./script/generate rspec
$ ./script/generate rspec_model Bar
$ rake db:migrate RAILS_ENV=test
$ autospec # => runs and passes one example
$ mkdir spec/something
$ touch ./autotest spec/something/lol_spec.rb
$ autospec -v # => correctly does not find a mapping for

Then I edit the files like so:

Autotest.add_hook :initialize do |at|
  at.add_mapping(%r%^spec/something/.*_spec\.rb$%) do

describe "Lol" do
  it "should do a thing" do
    false.should be_true

$ autospec -v # => still not finding a match for spec/something/lol_spec.rb
loading autotest/rails_rspec
No tests matched app/helpers/application_helper.rb
No tests matched spec/rcov.opts
No tests matched test/test_helper.rb
No tests matched lib/tasks/rspec.rake
No tests matched Rakefile
No tests matched README
No tests matched .autotest
No tests matched spec/something/lol_spec.rb
No tests matched test/performance/browsing_test.rb
No tests matched spec/spec.opts
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.2.6/bin/spec --autospec
spec/models/bar_spec.rb -O spec/spec.opts

Finished in 0.135414 seconds

1 example, 0 failures

# Waiting since 2009-05-17 16:22:56

Sorry to be so verbose but I'm honestly very lost at this point...
I've also tried variations of this the add_mapping method by using the
block variables but no go.


On Sun, May 17, 2009 at 2:31 PM, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Sun, May 17, 2009 at 11:45 AM, Adam Anderson
> <adamandersonis at gmail.com> wrote:
>> Is there a way to tell autospec for rails to run _all_ the spec files
>> in the spec directory a la spec/**/*_spec.rb instead of just the ones
>> in model/controller/etc? I've experimented with adding my own mappings
>> in <project_dir>/.autotest but haven't had any luck.
> See if this helps:
> http://blog.davidchelimsky.net/2008/01/15/rspec-1-1-2-and-zentest-3-8-0/
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list