Neil Cauldwell <[EMAIL PROTECTED]> writes:
> Pat Maddox wrote:
>> Neil Cauldwell <[EMAIL PROTECTED]> writes:
>>
>>>>> ...so shouldn't the spec fail if we're returning all the users fixtures
>>>> which is true. [1,2,3] is not an element of the array [1,2,3]. I used
>>> description);
>>> results
>>> ...so I'm one step closer but I'm now a little confused by the other
>>> specs.
>>
>> They are different. This is similar to the example I posted before:
>> [].should include([])
>>
>> that will fail...
>> [[]].should include([])
>>
>> will pass. Do you see the difference? One of them is an empty array,
>> and one of them is an array containing a single element (which is itself
>> an empty array).
>>
>> nil and [] are not equivalent in Ruby.
>>
>> Anyway, I'm pretty convinced that your stubbing isn't working at all.
>> You can verify this by changing
>> ThinkingSphinx::Search.stub!(:search).and_return(users)
>> to
>> ThinkingSphinx::Search.stub!(:search).and_raise("boom!")
>>
>> If your stubbed method is being called then it'll raise an error, but I
>> suspect it's not.
>>
>> As far as the fixtures stuff, I'm afraid I can't help much there. I
>> think rails db fixtures are the devil and so have managed to put them
>> completely out of my consciousness.
>>
>> Pat
>
>
> I just tried the raise;
>
> ThinkingSphinx::Search.stub!(:search).and_raise("BOOM")
>
> and;
>
> RSpec Results
> 36 examples, 5 failures
> Finished in 1.338815 seconds
>
> SearchesController handling GET /searches/people
> should be successful
> BOOM
>
> should render people template
> BOOM
>
> I should have left my mac by now as my brain is pretty much fried by
> this of night, but, unless I'm mistaken, that means the stub is working,
> right?
Yes, so, that's progress :)
Pat
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users