samedi 28 mars 2015

How to re-enable Test::Unit in Rails 4 after 'rails new app --skip-test-unit'

I used



rails new app --skip-test-unit


because initially, I thought I could add testing later.


I developed a significant portion of my app.


Now, I would like to add Test::Unit but I couldn't find any documentation on how to do it. Googling only lead me to the Rails Guides and tutorials that assume you didn't ask rails to skip the testing framework when you first created the app.


I know I might be able to figure out what _test.rb files to add manually and how to modify the Rakefile (by looking at an app that was created without skipping tests) but I prefer to find an easier approach if it exists.


I think the --skip-test-unit writes something somewhere to tell the Rails generators not to generate tests, and as well, it removes the rake tasks related to tests.


It would be good to find out if there is a command (or a config file modification) to restore Test::Unit to my Rails app.


I don't necessarily mind if the existing controllers/models do not have tests and I don't necessarily want to add tests to them, but going forward, I would like tests to be generated by the generators, and I would like to be able to run



rake test

Aucun commentaire:

Enregistrer un commentaire