I have what I think should be a simple problem, but I’m having issues finding a solution to it via Google.
I’m writing functional tests for my AccountsController. I began by adding tests to the test/functionals/accounts_controller_test.rb file, which worked fine. However, my testing has become significant enough that that file has gotten incredibly long. I would like to split my tests into individual files, like accounts_controller_test_index.rb, accounts_controller_test_show.rb, etc. I can do that, but it was a bit hacky-- the accounts_controller_test_show.rb had to look like this:
require ‘functional/accounts_controller_test’
class AccountsControllerTestShow < AccountsControllerTest … end
but even that was okay. The real problem is that the only way I can run this file is explicitly:
rake test TEST=test/functionals/accounts_controller_test_show.rb
It simply won’t run when rake test:functionals is called.
So, I have two questions:
- Is the way I’ve split this out (i.e. the require accounts_controller_test and inheritance) the right way to do this?
- How do I add this test to be run when rake test:functionals is run? I thought that rake task ran all the test/functionals/*.rb files, but apparently I was wrong.
Thank you!
Kyle