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

Andy Allan notifications at github.com
Wed Sep 7 15:33:45 UTC 2016


FactoryGirl is a widely used alternative to fixtures in tests. The fixtures are annoying since every time you want to test something slightly different (for example, a diary entry with an apostrophe in its title), you need to add a whole new fixture and rework the tests. Fixtures are also a pain when the model attributes change.

This PR adds FactoryGirl, and reworks two model tests (DiaryEntry and DiaryComment) to use them.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/1279

-- Commit Summary --

  * Add FactoryGirl
  * Rework DiaryEntry and DiaryComment model tests to use factories.

-- File Changes --

    M Gemfile (1)
    M Gemfile.lock (6)
    A test/factories/diary_comments.rb (10)
    A test/factories/diary_entries.rb (9)
    M test/models/diary_comment_test.rb (6)
    M test/models/diary_entry_test.rb (27)
    M test/test_helper.rb (2)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/1279.patch
https://github.com/openstreetmap/openstreetmap-website/pull/1279.diff

-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20160907/932288d9/attachment-0001.html>


More information about the rails-dev mailing list