I am trying to create tests for a class I have in /components. I have put my test file in /test/unit/custom_test.rb but it doesn't run when I do 'rake test'. What's wrong?
\
People succeed in answering Carl Mercier's questions 23% of the time (5 successes in 22 attempts).
Answers by: Rich Collins
You [shouldn't be using components](http://glu.ttono.us/articles/2006/08/30/guide-things-you-shouldnt-be-doing-in-rails) for one. I would also consider using rspec.
Regarding your specific problem, I have no idea. Don't you get output about which files are being loaded when you run rake test?
Why not use components? I need to build a custom class that isn't a model, a controller or a view. Where should I put it? I usually put them in components.
My test file is not loaded/ran when i run rake test.
Are you using "Rails Components" or are you just using the term component for something other than models, views or controllers?
Paste the rake output here.
I'm just putting my class in that folder. Maybe I should create my own folder that is not "components"?
AH! Just figured it out. My file wasnt really called custom_test.rb. It was called something else that didn't end with _test. Rails will only run tests on files ending by _test.rb. I thought the behavior was to run every file in the /test/unit/ folder (which would make more sense wouldnt??).
Anyway, it works now. Thanks! :)
You got it