I'm using Rails engines to break up a big app into smaller pieces. The parent app mostly handles users and authentication.
In one of my engine tests I want to log in a user before each test. How should I access this user log in functionality, which exists in the parent app, from the engine?
It seems there are two options:
1) Build user authentication into the dummy app. When you run
rails plugin new app_name --mountable a "dummy app" - just a plain Rails app - is created in your test folder. During tests the engine is mounted on to this dummy app. For feature (integration, acceptance, what-have-you) tests, I thought it would be good to use real objects whenever possible. So I was planning on using a factory to create a real user and then log in that user. To do this with the dummy app, I would need to build that user functionality in.
This seems like a pain because if the real parent app changes, I need to change this dummy app as well.
2) Put all my tests in the parent app. This will work fine, I think, but it seems fishy. I feel like I should put my engine tests in the engine.