17 Jun 2016
Reading time ~2 minutes
What I Did
Aside from attending FLF and a presentation about how to deliver presentations given by Laura, I spent the entire day today simply trying to familiarize myself with RSpec. After watching a decent video online, I felt that I had a general understanding of the monster that is testing in Rails, but it was not until Eli graciously offered me to shadow him while he wrote up a dozen unit tests relating to search functionality on the Shure website within the blink of an eye.
What I Learned
Through my interactions with YouTube videos and Eli, I was able to gather the following few things
- RSpec is preferred over Rails’ Test:Unit particularly because of its notable human readable syntax, though all testing units certainly do have their own merits.
- Feature specs are a kind of acceptance test implemented at a high level. They essentially walk through your application and automate users’ expected interactions with your app including user clicks, form submissions, etc. Because they rely on the proper functionality of all of your apps components individually and when integrated with each other (like models, views, and controllers), these tests are relatively slow to run.
- Model specs test a small part of a system (a given class or method) and they may entail interaction with a database.
- Controller specs are especially useful when testing that multiple paths through a controller are working properly.
- View specs generally contain conditional displays of information in templates.
- FactoryGirl is preferred over Rails fixtures, because it allows for database entries which are flexible, transparent to work with, and allow for more control.
- Database Cleaners are useful for removing records inserted in to the test database while in a testing environment.
What I Still Don’t Understand
I’ve still much to learn regarding how exactly to go about TDD and more specifically BDD. As of now, I’ve only a very surface level understanding of how unit tests are structured and have much to learn about feature tests. Of course, this knowledge will only become useful when I can efficiently go about writing out tests for an app in a structured manner from beginning to finish, out to in.
What I’m Interested in Learning
I’m interested in working at my front-end development skills at least to have them at a bare minimum acceptability level, because haxxor-news currently looks like a death trap.