The only non-resourceful thing in the elements API is `redact` action. However before I can do anything with it I need to take care of tests.
You'd expect controller action tests to first set up the state of the elements, then perform the request and finally check the response and the new state. Unfortunately tests for redacting/unredacting element versions don't do that. Instead of checking the state after the action they do new show/index requests and check responses to those. This is double-checking show/index actions for redacted/unredacted states which is already done. But what's worse, if I'm to move (un)redacting to a different controller, the test would check actions of different controllers. They'll become integration tests. But wait, some would-be integration tests already exist for different actions. You can see "FIXME: Move this test to being an integration test" on `test_show` in `old_nodes_controller_test.rb`. And you can see `with_controller` inside the tests. Also there's a similar situation in old ways controller. This PR moves `test_show` tests to integration tests and replaces them with tests that just check the show action. You can view, comment on, or merge this pull request online at: https://github.com/openstreetmap/openstreetmap-website/pull/5645 -- Commit Summary -- * Move api node version test to integration tests * Test api old node show action without integration * Move api way version test to integration tests * Test api old way show action without integration * Remove unused api old relation test code -- File Changes -- M test/controllers/api/old_nodes_controller_test.rb (202) M test/controllers/api/old_relations_controller_test.rb (43) M test/controllers/api/old_ways_controller_test.rb (61) A test/integration/node_versions_test.rb (194) A test/integration/way_versions_test.rb (52) -- Patch Links -- https://github.com/openstreetmap/openstreetmap-website/pull/5645.patch https://github.com/openstreetmap/openstreetmap-website/pull/5645.diff -- Reply to this email directly or view it on GitHub: https://github.com/openstreetmap/openstreetmap-website/pull/5645 You are receiving this because you are subscribed to this thread. Message ID: <openstreetmap/openstreetmap-website/pull/5...@github.com>
_______________________________________________ rails-dev mailing list rails-dev@openstreetmap.org https://lists.openstreetmap.org/listinfo/rails-dev