2023
How To Manage Duplicate Test Setup, or Can I Interest You In Weird RSpec?
You have a series of test cases. They cover the same logic with different inputs. In order to get to that logic, there’s some overhead: objects have to be created first. Then there’s more logic needed to evaluate the result.
What’s the best way to manage these tests?
You want it to be easy to add new tests. You also want it to be clear what part of the test is different in each round and what part is just the common logistics.
Better Know A Ruby Thing Bonus: Contestants and Nesting
Sorry for skipping a week or two – I was approving copyedits on the book that is now called Programming Ruby 3.3, because we now want to be proactive about the next release.
Coincidentally, the copyedit review does relate to this newsletter. I noticed a particular code sample as I was going through the book again, and it highlights a feature of Ruby’s constant lookup that I didn’t discuss last time.
Better Know A Ruby Thing #2: Constants
A fun thing about learning Ruby is that sometimes concepts that have the same name as in other languages have different behavior and purpose in Ruby.
Today: constants
They aren’t actually constant.
They aren’t only used for small strings or magic literals. They aren’t even mostly used for that in most Ruby programs.
Constants are one of the core pieces of Ruby and they aren’t super-well documented in the official site, so here we go…
Better Know A Ruby Thing #1: method_missing
Welcome to “Better Know A Ruby Thing”. In each one of these, we’re going to look at some feature of Ruby language, library, ecosystem, or culture and explain what it does, how it works, why it’s there, and any thing else that comes to mind.
First up, method_missing. If I may be poetic for a second, method_missing represents both infinite potential, and the possibility of a second chance when you can’t figure out what to do the first time around.
Books Recommendation List: 2022
Even by my standards, this one is slow to come out, so I’ll keep the intro brief.
As I’ve done for the past few years, I quasi-obsessively rank the books I read, and I write about the top several.
It’s 40 again this year, and again, I’m really sorry.
As usual, don’t take the rankings seriously, they’re just here for some kind of organization.
Book links go to Amazon Kindle pages.