简体   繁体   English

在Rails中将测试实现类放在哪里?

[英]Where to put test implementation classes in Rails?

I have a class in lib that has some application logic in it. 我在lib中有一个类,其中包含一些应用程序逻辑。 I want to have a separate implementation of this class that will be used in automated functional tests. 我想要一个单独的此类实现,将在自动化功能测试中使用。 Is there a good place where I can put this class to? 有什么好地方可以上这堂课吗? Ideally I don't want it to be loaded when I am running a web site in production. 理想情况下,当我在生产环境中运行网站时,我不希望加载它。

if the class in lib holds application logic, it should go in app/xyz . 如果lib的类包含应用程序逻辑,则应将其放入app/xyz

if you want to create a dummy subclass or a ducktype for testing, just put it into your test-file. 如果要创建虚拟子类或鸭子类型进行测试,只需将其放入测试文件中即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM