On Tue, May 13, 2008 at 9:20 PM, Pat M. remov[email protected] wrote:
I wonder why OP doesn’t create two records, call #most_recent, and
verify that the record returned is the one with the larger timestamp.
I’m sorry about the confusion here. Your idea sounds indeed better
(I’ll explain below).
If the code is “not yours” (and I think you ought to clarify what you
mean by that), then you should be testing it at a higher level instead
As I said, I’m not very familiar with specs and stuff, and I’ve read
repeatedly on this list and other places that one should only test
one’s own code. That is, if you declare a has_many association, you
shouldn’t test that the methods actually return the proper model
objects, etc., because that would be testing ActiveRecord. In that
same spirit, I thought I shouldn’t test that a named_scope does what
it’s supposed to, only that it is declared (because that one line is
all I wrote myself).
But I guess I got a bit carried away, as in that declaration there is
stuff besides the declaration itself, namely, the bit specifying the
order. So it would be better to test for that, rather than just
testing if it was declared or not.
Thanks a lot for your help
rspec-users mailing list
“If I have not seen as far as others, it is because giants were
standing on my shoulders” – Jeff Goll