Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate a dummy app inside an already existing rails engine

I came to work for a company recently that has been working on a specific rails project for a while. Dropped in the middle of the development process, I'm beginning to go back and write tests for the existing code as well as the code currently being produced.

Testing the rails 4 app was easy enough, but once I got to testing the engine, I hit a mental block. After doing my due diligence, I found that most people take an approach like this (http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl), but the common thread I saw in all of these responses was that people were building these apps from scratch, and thus had a dummy app generated for them automatically. I don't have the benefit of being able to generate everything from scratch, and have to work with what I was given, so what

I'd like to know is if there's a way to retroactively generate just the dummy application. Is there something simple I can type into the console and have it generated for me? Or is there a longer, slightly less pretty route? Or would a different strategy be better altogether?

like image 389
Austintacious1 Avatar asked May 06 '14 13:05

Austintacious1


1 Answers

Given that the dummy app is not supposed to be tied to the parent gem except for some vague names, that may do it:

cd some_path_where_your_engine_IS_NOT rails plugin new YOUR_ENGINE_NAME --mountable --dummy-path=spec/dummy --skip-test-unit mv YOUR_ENGINE_NAME/spec/dummy /real/path/to/YOUR_ENGINE_NAME/spec rm -rf YOUR_ENGINE_NAME  # cleanup useless cruft 

Also, you may be interested in this answer to generate the app with the exact same rails version.

like image 57
Lloeki Avatar answered Oct 19 '22 04:10

Lloeki