Maybe you want to read
Test Driven Development in Rails – Part 2
June 21, 2016
Rewrite vs. Refactor: The limits of one against the other.
February 16, 2017
Metaprogramming in Rails: The Internals
January 7, 2016