在 Rails 项目中创建单元测试时,我问自己的第一个问题是“组织单元测试的约定是什么”,因为几乎所有其他内容都是由约定决定的。另外,我很好奇 MiniTest、TestUnit 和 Rspec 之间的约定是否发生了变化。
到目前为止,我所做的是在我的 test/unit 目录中镜像我的 Rails 目录结构,如下所示:
[Rails Root]
/lib/
./postgres.rb
./awesome_parser.rb
/app/helpers
./psychic_helper.rb
/test/unit/
./lib/postgres.rb
./lib/awesome_parser.rb
./app/helpers/psychic_helper
组织测试的最传统方式是什么,这样当其他人加入这个项目时,他们就不会诅咒我的名字?