• Home
  • About
    • Bio
    • CV
  • Music
    • Shows
    • Works
  • Research
    • Works
  • Programming
    • Projects
  • Blog
    • Watson
    • Viget
  • Contact
    • Message
    • Subscribe
    • Availability

RSpec

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

  1. 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.
  2. 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.
  3. Model specs test a small part of a system (a given class or method) and they may entail interaction with a database.
  4. Controller specs are especially useful when testing that multiple paths through a controller are working properly.
  5. View specs generally contain conditional displays of information in templates.
  6. FactoryGirl is preferred over Rails fixtures, because it allows for database entries which are flexible, transparent to work with, and allow for more control.
  7. To test JavaScript, one must install a JavaScript driver (either a GUI like Selenium or a headless browser like capybara-webkit )
  8. 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.



Share Tweet +1