[rspec-users] rspec + autotest + rails engines

rafaelmazza rafaelmazza at gmail.com
Mon Nov 23 16:21:55 EST 2009


Hi everyone,

I'm developing a rails app with several engines. I was wondering if
it's possible to autospec all my engine's specs. I've tried putting
the following content into my .autotest (in the app's root directory):

Autotest.add_hook :initialize do |at|

  # find all my plugins with an spec directory
  engine_plugins = Dir['vendor/plugins/*'].select{|dir| File.directory?
("#{dir}/spec")}

  engine_plugins.each do |plugin_path|

    at.add_mapping %r%^#{plugin_path}/app/models/(.*)\.rb$% do |_, m|
      at.files_matching "#{plugin_path}/spec/models/#{m[1]}_spec.rb"
    end

  end

end

But when any plugin's model is changed, for example, it seems that
nothing happens.
Has anybody tried it before?

Thanks in advance!


More information about the rspec-users mailing list