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

17 views
Skip to first unread message

Alain Achkar

unread,
Apr 9, 2015, 4:09:29 PM4/9/15
to ogre...@googlegroups.com
Sorry to post here and on SO, but I haven't had much luck on SO:
https://stackoverflow.com/questions/29325977/how-to-re-enable-testunit-in-rails-4-after-rails-new-app-skip-test-unit

Please, kindly do no suggest other testing frameworks. My question is specifically for the testing framework that comes with Rails 4.
------------

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
Reply all
Reply to author
Forward
0 new messages