Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Ruby/Rails testing.. what's the logic? Is it just me or am I crazy...
Ok..I understand the concept of TDD, but it really seems to me like a lot of wasted time seeing that you're writing like 5 times more code writing a test to test one or two lines of code, seems like overkill. Is this method of testing a good example of real world Rails development and testing? Just my two cents, I'm sure someone here has more experience on the subject than me.... Thanks
I get that it's important habit to develop, I just think in this tutorial it's a bit overkill. There was what over 200 lines of test code just to test a controller with 40 lines? I agree that maybe a module just on testing would be good. I feel like I really wanted more info as to why certain things were being done in the controller and models as opposed to "this is what I'm going to do" without knowing a little more about why. All in all this is a good track but I think by the end of it you feel like you want more why as opposed to "dear god not another test".....just my 2 cents
Brandon Barrette20,485 Points
It's a good habit to get into. You will write stronger and more robust code if you test it before it goes live to your users.
I think a simple example would be the Affordable Care Act website. Not tested very well and failed miserably.
I've definitely not written tests for all my code and have run into problems with things appearing to work, but really throwing errors.
I would really like to see a whole course on here about how to write really good tests and what gems might help one do that.