• 0

How to test a private method in rspec

Since you cannot access a private method directly, in order to test a private method, you can make use of the 'send' method that is available on all objects.

@obj = MyClass.new
result = @obj.send(:my_private_method, arguments)
expect(....)