[英]How can I get autotest to notice changes in subdirectories?
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? 如何进行自动测试以注意到对foo-*。rb所做的更改,然后运行适当的规范?
Perhaps you should investigate watchr 也许你应该调查观察者
https://github.com/mynyml/watchr https://github.com/mynyml/watchr
It's similar to autotest, while being quite a bit more configurable and more easily setup. 它与自动测试相似,但更具可配置性且更易于设置。
You can populate your autotest/discover.rb file with mappings: 您可以使用映射填充autotest / discover.rb文件:
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 . 您可以在API文档中找到更多如何使用映射和挂钩的信息 。
另一个有趣的选择是后卫 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.