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

Tom Hughes notifications at github.com
Wed Sep 7 20:21:30 UTC 2016

>      end
>    end
>    def test_diary_entry_comments
> -    assert_equal 0, diary_entries(:normal_user_entry_1).comments.count
> -    assert_equal 4, diary_entries(:normal_user_geo_entry).comments.count
> +    diary = create(:diary_entry)
> +    create(:diary_comment, :diary_entry => diary)

I wonder if a more canonical way to do this is something like:

diary = create(:diary_entry) do |diary|

I mean I don't really know if it's any better or worse, it's just the sort of thing I was seeing in the FactoryGirl docs.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20160907/6c0e5e51/attachment.html>

More information about the rails-dev mailing list