ruby-on-rails – 如何从spork过渡到spring?
我目前正在使用Spork with Guard,Rspec和Cucumber.我想转移到
Spring,但找不到任何需要更改的文档.
具体来说,我很好奇我是否需要更改我的: require 'spork' Spork.prefork do # ... end Spork.each_run do # ... end …有类似的东西: require 'spring' Spring.prefork do # ... end Spring.each_run do # ... end 但是,我知道there isn’t a 解决方法
正如您在问题中提到的那样,没有Prefork块.这些文档提供了一种解决方法:只需将现有的Spork.prefork块移动到初始化程序或Rails将在加载时将其拾取并运行的任何位置.
从https://github.com/rails/spring#running-code-before-forking开始:
至于你的Spork.each_run块,因为你正在使用Rspec,你可以将它移动到before(:suite)块中.请参阅before and after hooks上的Rspec文档 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |