Implementing and Testing the Singleton Pattern in Ruby
What is a Singleton Object?
The GoF identifies a singleton as a way to "ensure a class only has one instance, and provide a...more.
What is a Singleton Object?
The GoF identifies a singleton as a way to "ensure a class only has one instance, and provide a...more.
TL; DR
Rather than including modules and hooking into .included, write a method that adds the behaviour (even if the method just includes and extends).
I've spent the last several months writing my own mock objects, but for the code I'm currently working on, we were mostly using RSpec's built...more.
So if you're like me, you're 5'10" and sport a ruggedly awesome beard. And if you're really like me, you swallowed the T/BDD pill years...more.