The Definitive RSpec Tutorial With Examples

Would you like to learn how to write tests for your Ruby applications using RSpec? Then you’re in the right place! In this tutorial I’ll show you how to do that. Contents Why Should You Write Tests? Here’s why: It builds a safety net against errors (especially useful for refactoring) If you don’t have a … Read more

Everything You Need to Know About Ruby Operators

Ruby has a lot of interesting operators. Like: The spaceship operator (<=>) The modulo assignment operator (%=) The triple equals (===) operator Greater than (>) & less than (<) Not equals (!=) What you may not realize is that many of these operators are actually Ruby methods. This means… You can overwrite what they do … Read more

Why Do We Create Classes?

Following my last article, why do we use nil, I thought it’d be a good idea to ask this question for other things that we take for granted. Like… Why do we use classes instead of having just one GIGANT blob of ugly code? At a fundamental level, we use classes to organize code & … Read more

Why Do We Use Nil?

I was having a chat with a friend about a piece of Ruby code & the topic of return values came up… …and of course, nil is always part of that conversation. Later that day, I was in bed about to go sleep, thinking, why do we use nil? I thought it would be a … Read more