Logan Bailey

Adventures In Web Development

Blog, About, GitHub, and LinkedIn

Testing With Traits

April 5th, 2018
Traits are an easy way to share code between classes, but how do you test them? I used to test the trait in isolation and not test the traits functionality while testing the classes that used the trait. This lead to passing tests and bugs. I tried copy and pasting code between tests, but this always seemed like a bad solution. Lately, I've been using traits to test traits and have been happy with the results so far.

You're Writing Your Tests Wrong

March 31st, 2017
While preparing for a talk, I realized that I'd been writing unit tests wrong for the last 3 years. I'd always approached test writing iteratively rather than from the outside in. With this one change, I was able to write cleaner more maintainable tests.