[rspec-users] Spec for 'an array should not include an item'
pergesu at gmail.com
Wed Oct 1 17:13:50 EDT 2008
Neil Cauldwell <lists at ruby-forum.com> writes:
> Pat Maddox wrote:
>> Neil Cauldwell <lists at ruby-forum.com> 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
>>> ...so I'm one step closer but I'm now a little confused by the other
>> 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
>> 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.
> I just tried the raise;
> RSpec Results
> 36 examples, 5 failures
> Finished in 1.338815 seconds
> SearchesController handling GET /searches/people
> should be successful
> should render people template
> 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,
Yes, so, that's progress :)
More information about the rspec-users