문제

I have some submodules organized like this:

|-- app
|   |-- models
|   |   |-- foo
|   |   |   |-- foo-1.rb
|   |   |   |-- foo-2.rb
|   |   |   |-- foo-3.rb
|   |   |-- foo.rb

How can I get autotest to notice changes made to foo-*.rb, and then run the appropriate specs?

도움이 되었습니까?

해결책

You can populate your autotest/discover.rb file with mappings:

Autotest.add_hook :initialize do |at|
  # match the model name (the whole Regex object is in _)
  at.add_mapping(%r%^app/models/(foo)/\w+\.rb$%, true) do |filename, _|
    "spec/models/#{_[1]}_spec.rb"
  end
end

You can find more how to use the mappings and hooks in the API docs.

다른 팁

Perhaps you should investigate watchr

https://github.com/mynyml/watchr

It's similar to autotest, while being quite a bit more configurable and more easily setup.

Another interesting alternative is guard.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top