[rspec-users] Setup for autospec for non-rails project

Rick DeNatale rick.denatale at gmail.com
Tue Dec 2 12:01:30 EST 2008

I brought this up some time ago.

I'm trying to use autotest to run specs in a non-rails project.

FWIW the project is structured using the bones gem.

$ spec -v
rspec 1.1.11
k$ gem list zentest

*** LOCAL GEMS ***

ZenTest (3.11.0, 3.9.1, 3.9.0, 3.8.0, 3.7.1, 3.7.0, 3.6.1)

$ cat .autotest
Autotest.add_hook :initialize do |at|
  %w{.svn .hg .git .bzr}.each { |exception| at.add_exception(exception) }

  at.add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|


Autotest.add_discovery do
  "rspec" if File.directory?('spec') && ENV['RSPEC']

$ autospec
loading autotest/rspec
/opt/local/bin/ruby -S spec/lib/v_date_time_property_spec.rb
spec/lib/v_date_property_spec.rb spec/lib/v_property_spec.rb
spec/lib/parser_spec.rb spec/lib/t_z_info_vtimezone_spec.rb
spec/lib/v_date_time_property_spec.rb:8: warning: parenthesize argument(s)
for future version
spec/lib/v_date_time_property_spec.rb:12: warning: parenthesize argument(s)
for future version
spec/lib/v_date_time_property_spec.rb:4: undefined method `describe' for
main:Object (NoMethodError)

For some reason, it's running the specs as plain old ruby files and the
RSpec framework doesn't seem to be being intialized.

I've done lots of googling about this, and everything about running autotest
for RSpec for non-rails projects seems to be quite old.  I did find one old
post which recommended making a .autotest file in the project with mappings
based on the rspec-rails mappings, which is what I tried above, but no joy.

Any insight?

Rick DeNatale

My blog on Ruby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081202/84aa8a0d/attachment-0001.html>

More information about the rspec-users mailing list