This example demonstrates the feature well (which is the most important thing) but I would _never_ recommend replacing a built-in type like a string with a test double for something like this.  Far better to stub the constant with a replacement string.

Coming up with good examples is hard of course, but what about something like this:

``` ruby
require 'logger'

class Email
  LOGGER = Logger.new

  def self.send_to(recipient)
    LOGGER.info("Sending email to #{recipient}")
  end
end

describe Email do
  it 'logs a message when sending' do
    logger = object_double("Email::LOGGER", info: nil).as_stubbed_const
    Email.send_to('hello@foo.com')
    expect(logger).to have_received(:info).with("Sending email to hello@foo.com")
  end
end
```