If your at least somewhat familiar with object-oriented programming concepts already, I would highly recommend the following course: https://courses.edx.org/courses/BerkeleyX/CS169.1x/2013_Spri...
It deals with modern programming practices in the ruby/rails environment. I'm working through it myself and it's already answered a lot of questions that I've had about most of the tools you mention and how they work. It has specific sections on BDD and TDD also, among other relevant topics.
If you need some more general background first, take an introductory computer science course. I would recommend CS106A Programming Methodology from Stanford, which is a good pre-requisite course for the one listed above.
All of these courses are free.