views:

64

answers:

0

Most of my work in a rails application is done with rails engines. When I develop new applications, it usually use a custom built cms. My CMS was inspired by refineryCMS in that there is a core that lives as a rails engine. Features that make up the application are other rails engines that register themselves with the core. For example the Pages feature of the cms lives as a self contained engine.

What I am trying to figure out is, how I can get autotest to map the tests in the engines, the same way autotest-rails maps to the main "app" folder to the main "test" folder. I have learned by looking at the autotest-rails project that the method Autotest.add_mapping is more then likely what I need to use.

In the simplest form of a test, here is what I have for my project .autotest file:

Autotest.add_hook :initialize do |at|
  at.add_mapping %r%^vendor/plugins/case_studies/app/controllers/admin/case_studies_controller.rb$% do |_, m|
    "test/functional/admin/case_studies_controller_test.rb"
  end 
end

With the above configuration I keep getting this error:

Unable to map class Admin::CaseStudiesControllerTest to a file

I think it has something to do with my namespacing. But the namespacing cannot be avoided, because I breakout my features with an admin controller and a public controller, which will both need their own test.

I'm trying as well to avoid triggering all of the test everytime a MVC file changes in the engine. I'm trying to only run the targeted test for the saved edit of the MVC file, much the same way that auto-test works. The reason for this is, these projects tend to get large and to run all of the projects test could take a couple of minutes.

Has anyone seen this before?