[rspec-users] Spec failing [Possible Bug with kind_of? and instance_of?]
Jerry West
jerry.west at ntlworld.com
Sat Feb 24 13:36:36 EST 2007
Answer written in haste, so may well be wrong...
Rails associations are not Arrays even though they claim to be. I think
they are ActiveRecord::Associations::AssociationProxies; why they claim to
be Array I have no idea, simply being Enumerable would have sufficed I
would have imagined. Why they proxy an array rather han extending it I
have no idea. I have very few ideas :-). I personally believe proxies
that lie to the developer like this should Be Considered Harmful, but it's
not my opinion that counts in this particular piece of opinionated
software :-).
I haven't yet worked out how to tell an AP from an Array.
Hope this helps. Hope I've remembered correctly too!
Rgds,
Jerry
On Sat, 24 Feb 2007 10:21:25 -0000, Scott Taylor
<mailing_lists at railsnewbie.com> wrote:
>
> I have a spec which is failing, but I just can't say why. Maybe I'm
> missing something painfully obvious?
>
> Here is the pastie of the results & the spec:
>
> http://pastie.caboo.se/42626
>
> The spec to look for is "should have an array of users" I've printed
> out ("puts'ed") to the terminal the fact that the values are
> *opposite* to what the spec fails on...
>
> Thanks, all, for your help,
>
> Best Regards,
>
> Scott Taylor
>
>
> P.S. In the future shall I just plop in a bunch of code to my
> message, or is pastie a good means for delivering somewhat large
> chunks of code?
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the rspec-users
mailing list