$ rake spec:autotest:rails
trunk/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour/rails_example.rb:31:
undefined method before' for Spec::Rails::DSL::RailsExample:Class (NoMethodError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:ingem_original_require’
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in require' from trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:inrequire’
from
trunk/vendor/rails/activerecord/lib/…/…/activesupport/lib/active_support/dependencies.rb:342:in new_constants_in' from trunk/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:inrequire’
from
trunk/vendor/plugins/rspec_on_rails/lib/spec/rails/dsl/behaviour.rb:2
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
… 25 levels…
from
/usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/lib/spec/runner/command_line.rb:17:in run' from /usr/lib/ruby/gems/1.8/gems/rspec-1.0.8/bin/spec:3 from /usr/bin/spec:16:inload’
from /usr/bin/spec:16
I’m currently running rspec at r2794
If there’s another method that is preferred for automatic testing,
please
let me know.
‘spec_server’?
Autotest looks at the load path when it starts up, and then looks in
each load path for a file named lib/autotest/discovery.rb. Autotest
requires rubygems, which by default puts any gems in the loadpath.
So it goes through, and finds that rspec has this discovery.rb, and
applies it if makes sense for your project (that is, if the spec/
directory exists in your project root).
With this knowledge, if you really didn’t want to install the gem,
you could add RAILS_ROOT/discovery.rb to require the discover.rb in
RAILS_ROOT/vendor/plugins/rspec/lib/autotest/discover.rb - but my
guess it that’s a bit much.
The simple answer, if you just want to get it to work, is to install
the gem.
I’m running from trunk, and don’t have the gem installed. How is
autotesting enabled? Is it a special switch passed to ‘spec’ or
‘spec_server’?
gem install ZenTest
cd RAILS_ROOT
autotest
Cool. I already had zentest(I think for rspec_autotest), so just running
autotest seems to do the trick. One question maybe you can answer. When
it
starts it runs all tests, which is cool. Then if I go and make a spec
that
fails, it tests it which is good. If I then fix that spec, it
runs the spec, and when done then goes and runs all of the files again
after that which is kind of annoying(and time consuming). Is there any
way
to disable that? The help options are rather sparse.
Cool. I already had zentest(I think for rspec_autotest), so just running
autotest seems to do the trick. One question maybe you can answer. When it
starts it runs all tests, which is cool. Then if I go and make a spec that
fails, it tests it which is good. If I then fix that spec, it
runs the spec, and when done then goes and runs all of the files again
after that which is kind of annoying(and time consuming). Is there any way
to disable that? The help options are rather sparse.
That’s how autotest works. That’s the whole point of autotest. It
keeps you focused on the granular problem until you fix it and then
makes sure you didn’t break anything anywhere else in the process.
I don’t think you can change that, but check the autotest docs. If
they don’t tell you what you need, file a feature request for that
project.
David
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.