How can I validate an rspec instance_double as an instance of the doubled class?
<p>In my code, i test that an object is an instance of a particular class, however instance doubles are a class of <code>RSpec::Mocks::InstanceVerifyingDouble</code></p>

<p>a contrived example is...</p>

<pre><code># spec
@double = instance_double Foo
allow(Bar).to receive(:foo).and_return @double

# lib
until Bar.foo.instance_of? Foo
  # logic to test
  if something == true
    Bar.foo = Foo.new
  else
    Bar.foo = nil
  end
end
</code></pre>

<p>Is there any way to manipulate the rspec double to mock the class?  Or do i need to just return an actual instance of Foo?</p>

<p><strong>UPDATE</strong>
I mean to mention, they way i am currently getting around the problem, is like this...</p>

<pre><code># spec
allow(Bar).to receive(:foo).and_return Foo.allocate

# lib
if Bar.foo.instance_of? Foo
  # do something
end
</code></pre>

<p>I am fine with this solution, since initialize on Foo isn't actually executed, but I would prefer to use rspec/doubles for consistency</p>

<p><strong>UPDATE</strong>
Changed the example to (hopefully) be more clear. I need to test the results of  <code>something</code>, VS the results of <code>Bar.foo</code>. <em>Writing contrived examples is difficult :)</em></p>