Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running spec for a rails engine from its parent app

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?

like image 246
papricek Avatar asked Mar 11 '12 14:03

papricek


1 Answers

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.

like image 147
westonplatter Avatar answered Nov 04 '22 12:11

westonplatter