I don't think this implementation plays nice with `as_stubbed_const` -- because when you stub the const, it'll define the constant and the `recursive_const_get` call will return the double itself rather than the original class being doubled.

Instead, I think you need to use the query API provided by rspec-mocks' constant mutation support:

``` ruby
RSpec::Mocks::Constant.original(@doubled_class_name).original_value
```

Here's the way rspec-fire handled this, FWIW:

https://github.com/xaviershay/rspec-fire/blob/44a173b7e8b21a9aa90f53e137cb320fdb69ad6c/lib/rspec/fire.rb#L199-L208
https://github.com/xaviershay/rspec-fire/blob/44a173b7e8b21a9aa90f53e137cb320fdb69ad6c/lib/rspec/fire.rb#L329-L332