Ruby on Rails
Saturday, August 17, 2013
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:
1) Is the way I've split this out (i.e. the require accounts_controller_test and inheritance) the right way to do this?
2) 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
-- 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:
1) Is the way I've split this out (i.e. the require accounts_controller_test and inheritance) the right way to do this?
2) 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
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/04d138c8-91e4-4fe0-8d87-13af6f697d13%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment