[openstreetmap/openstreetmap-website] Rework some tests to use factories instead of new objects (PR #3518)

Andy Allan notifications at github.com
Wed Mar 30 16:29:37 UTC 2022


This PR reworks some model tests to use factories, instead of creating new objects. This tends to simplify the tests, since there's often less boilerplate in setting up the new object to be valid.

It also reworks the "empty" tag tests, since it wasn't clear from the naming and code exactly what was being tested. So I've refactored these to show that they are testing that the parent object is set.
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Rework 'empty' tag tests
  * Simplify changeset tag tests by using factories
  * Use factories for tag uniqueness tests

-- File Changes --

    M test/models/changeset_tag_test.rb (54)
    M test/models/node_tag_test.rb (12)
    M test/models/old_node_tag_test.rb (13)
    M test/models/old_relation_tag_test.rb (13)
    M test/models/old_way_tag_test.rb (9)
    M test/models/relation_tag_test.rb (12)
    M test/models/way_tag_test.rb (9)

-- Patch Links --

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

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3518
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/3518 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220330/ea10b5da/attachment.htm>


More information about the rails-dev mailing list