Running spec for a rails engine from its parent app

耗尽温柔 提交于 2019-12-05 23:17:05

问题


I have rspec suite for parent app, and also some spec for engines attached. What I want is to run them with one command. Is there a way to include my gems paths into rspec load path? Or should I write rake task for this?


回答1:


I think this is an interesting question, but my opinion is that Rails Engines should be treated as an independent code base and therefore not tested in your parent app. The effect is that you'd treat a Rails Engine in your parent app much like you treat other gems (EG, devise, which is actually a Rails Engine).

But let's say you have parent app functionality that relies on a Rails Engine feature. In that case, I would write a test to show that my parent app's functionality works in conjunction with the Rails Engine. I would not write the test ensuring that the Rails Engine works as it is supposed to because those tests belong in the Rails Engine code base, not the parent app.

I realize this methodology does not apply perfectly in real work scenarios when you are simultaneously developing the parent app and the Rails Engine.



来源:https://stackoverflow.com/questions/9655874/running-spec-for-a-rails-engine-from-its-parent-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!