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.clear_mappings
at.add_mapping(%r%^(spec/(spec_helper|shared/.)|config/(boot|environment(s/test)?)).rb$%)
{
at.files_matching
%r%^spec/(models|controllers|views|helpers)/.spec.rb$%
}
at.add_mapping(%r%^lib/(.*).rb$%) { |, m|
[“spec/lib/#{m[1]}_spec.rb”]
}
end
Autotest.add_discovery do
“rspec” if File.directory?(‘spec’) && ENV[‘RSPEC’]
end
$ 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
http://talklikeaduck.denhaven2.com/