On Apr 5, 2012, at 6:03 PM, James wrote:

> Hi,
> I have two stubs in two different specs (one model, one controller).
> For some reason they are causing some strange conflict with one
> another.

It's not strange at all. Your child classes will inherit the stubs of the 
parent class.

> If I comment out the controller stub, the model spec passes.
> 
> Controller Spec
> -----------------------------------
> require 'spec_helper'
> describe MyClass::SomeController do
>    it 'should do stuff' do
>      Some::Base.stub!(:mystub)   #IF I COMMENT THIS OUT IT PASSES
>    end
> end
> 
> 
> I have this line in another model spec
> ------------------------------------------------------
>    Some::Thing.should_receive(:mystub).exactly(4).times.and_return
> nil
> 
> 
> 'Thing' is a child class of 'Base'.
> 
> Here is the error:
> ----------------------------
>     Failure/Error:
> Some::Thing.should_receive(:mystub).exactly(4).times.and_return nil
>       (<Some::Thing (class)>).mystub(any args)
>           expected: 4 times
>           received: 2 times
> 
> 
> 
>  * rspec (2.9.0)
>  * rspec-core (2.9.0)
>  * rspec-expectations (2.9.0)
>  * rspec-mocks (2.9.0)
>  * rspec-rails (2.9.0)
> rails (3.0.4)
> ruby 1.8.7
> 
> Thanks in advance!
> 
> James
> 
> 
> 
> 
> 
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to