rspec/rspec-core — pull request #920 by rondale-sc (2013-05-29 04:03:28+00:00)
Title: Ensure MemoizedHelpers#its respects object visibility.

@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:

```ruby
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