rspec/rspec-mocks — pull request #550 by mauricio (2014-01-31 02:13:56+00:00)
Title: RSpec::Mocks::NamedObjectReference doesn't have a name method, creating specific spec for this case so there are no false positives

So, was hacking some specs and started to see the following error:

Failure/Error: expect {
expected RSpec::Mocks::VerifyingDoubleNotDefinedError, got #> with backtrace:
# ./lib/rspec/mocks/example_methods.rb:182:in `declare_verifying_double'
# ./lib/rspec/mocks/example_methods.rb:46:in `instance_double'

Digging a bit into the source, the issue is that if the constant name given isn't loaded yet, it would try to raise an exception but would fail to do so because the double given does not have a `name` method, but it does have a `description` one.

The issue was not found on `rspec-mocks` specs because the match was for `NameError` and `NoMethodError` inherits from it, making that specific match a not very useful one.

So, I created a new exception for this specific case, changed the call from `name` to `description` and updated the matches for both cases.