[openstreetmap/openstreetmap-website] Add Factorygirl as an alternative to fixtures (#1279)

Tom Hughes notifications at github.com
Thu Sep 8 07:57:30 UTC 2016


Yes I always find that a lot of model tests involve a fair bit of "what exactly are we really testing here" head scratching...

I mean obviously if you have a method with some addition logic in it on a model that's fine and can be tested but a lot of the time the tests as you say seem to be testing rails more than our code. I think things that make sense in a model test are:

* That any additional methods written by us work
* That associations return the expected records, especially where they involved filtering, ordering, etc
* That validations allow/reject the correct things

On the other handing, testing that `count` returns the right number of records is probably less useful ;-)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/1279#issuecomment-245522072
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20160908/6d49fbb8/attachment.html>


More information about the rails-dev mailing list