What’s the best way to unit test protected & private methods in Ruby?
You can bypass encapsulation with the send method: myobject.send(:method_name, args) This is a ‘feature’ of Ruby. 🙂 There was internal debate during Ruby 1.9 development which considered having send respect privacy and send! ignore it, but in the end nothing changed in Ruby 1.9. Ignore the comments below discussing send! and breaking things.