views:

372

answers:

2

I am adding a directory for services classes in my rails application: app/services

I would like to add specs for these classes in the directory: spec/services

I added a spec to spec/services, but running autospec does not run the example.

Is there a way to configure autospec to run examples in new directories?

Thanks.

A: 

Try adding this to your spec_helper.rb:

require 'services'
Delameko
i get the following error:`gem_original_require': no such file to load -- services (MissingSourceFile)
Lee
+2  A: 

I believe I have found the answer to my question. I added a file ".autotest" to the root of my project with the following content:

Autotest.add_hook :initialize do |at|      
  at.add_mapping(%r%^spec/services/.*_spec\.rb$%) do
    at.files_matching(%r%^spec/services/.*_spec\.rb$%)
  end
end

Source: http://www.ruby-forum.com/topic/187144

Lee