Ah... it WAS a simple problem. I know I've seen this multiple times, but I never had to use this knowledge until now: the rake tasks don't recursively run *.rb files, they recursively run *_test.rb files. I just had to name my files better.
My first question still stands, though. If I don't do the include/inheritance, I get complaints about the AccountsController not existing.
Kyle
On 08/17/2013 10:54 AM, Kyle Fazzari wrote:
> 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
> --
> You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/-7PgmiuguRE/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
--
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/520FC5CD.2020409%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment