Ensure MemoizedHelpers#its respects object visibility.
Created by: rondale-sc
@syntaxritual, @nurugger07, @rjackson, and I stumbled across and interesting problem with regards to MemoizedHelpers#its.
Before this patch If you call a private_method on an implicit subject with #its like:
subject do
Class.new do
private
def private_name
"foo"
end
end
end
its(:private_name) { should eq("foo") }
Rspec will not through a NoMethodError as one would expect. This patch attempts to address this in a way that is backward compatible (no public_send).
To accomplish this we added a _visibility?
method that checks for the availability of the method before calling send. If the method is not visible it throws a NoMethodError.
Cheers, Jon