|
|
|
|
|
by biznickman
4843 days ago
|
|
I think the bigger issue here is that new developers of Rails don't understand the best practices for testing. I switched from PHP to Ruby, then learned rails over the past year and it had a significant learning curve. First I tried testing models and controllers, skipping views. Now I use integration tests with Capybara because it effectively tests the whole stack without writing redundant test code. What's not clear is the pros and cons of each approach. Over time you end up using your own approach that works best for you. It's one thing to know that you need to "test your code", but with all the various testing libraries created, it can quickly become overwhelming. In an ideal world, I'd like to learn more about the various approaches. Test::Unit vs Rspec, vs all the additional testing add-ons and how everything works together. When you end up spending just as much time writing tests as you do writing code, you quickly realize how critical getting the right approach to testing really is. |
|
Does this mean you primarily rely on integration tests at the exclusion of model unit tests?
If that's the case, I'm of the opinion you would be well served by revisiting your unit tests. Controller tests are kinda taken care of by integration tests, but you won't get solid coverage of your models with integration tests alone.
At a minimum, model unit + integration (skipping controllers), IMHO. If for no other reason than running an integration test suite can be time consuming, and you don't always need your feedback loop to be that long.