Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 lib/ 目录中有一些代码实际上不属于控件、模型或助手。我想为此代码编写一些 rspec 测试,但不确定它们应该放在 spec/ 目录下的哪个位置。是否有普遍遵循的约定?
我也会使用 /spec 的子目录。但是,如果它真的是独立的并且可以独立测试,我会考虑将代码重构为一个单独的插件或 gem。在这个插件中,您可以创建一个单独的规范目录。