Freeze Your Constants in Ruby
Years ago, I worked on a very large Ruby on Rails codebase that used constants to hold lists of credit card transaction states. For example:
ACTIONABLE_STATES = [:authenticated, :to_settle]
DONE_STATES = [:settled, :declined]
However, we had a bug where a settled transaction would return
txn.state.in? ACTIONABLE_STATES was called on it.