From: Andy Allan Date: Thu, 30 Mar 2017 12:57:30 +0000 (+0100) Subject: Use node factories for browse_controller tests. X-Git-Tag: live~4007 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/06814eb7158706d6733616565318f9ba07a2c6b6 Use node factories for browse_controller tests. --- diff --git a/test/controllers/browse_controller_test.rb b/test/controllers/browse_controller_test.rb index 567fc0576..12262b224 100644 --- a/test/controllers/browse_controller_test.rb +++ b/test/controllers/browse_controller_test.rb @@ -62,11 +62,11 @@ class BrowseControllerTest < ActionController::TestCase end def test_read_node - browse_check "node", nodes(:visible_node).node_id, "browse/feature" + browse_check "node", create(:node).id, "browse/feature" end def test_read_node_history - browse_check "node_history", nodes(:visible_node).node_id, "browse/history" + browse_check "node_history", create(:node, :with_history).id, "browse/history" end def test_read_changeset @@ -135,7 +135,11 @@ class BrowseControllerTest < ActionController::TestCase # then please make it more easily (and robustly) testable! ## def test_redacted_node - get :node, :id => current_nodes(:redacted_node).id + node = create(:node, :with_history, :deleted, :version => 2) + node_v1 = node.old_nodes.find_by(:version => 1) + node_v1.redact!(create(:redaction)) + + get :node, :id => node.id assert_response :success assert_template "feature" @@ -147,7 +151,11 @@ class BrowseControllerTest < ActionController::TestCase end def test_redacted_node_history - get :node_history, :id => nodes(:redacted_node_redacted_version).node_id + node = create(:node, :with_history, :deleted, :version => 2) + node_v1 = node.old_nodes.find_by(:version => 1) + node_v1.redact!(create(:redaction)) + + get :node_history, :id => node.id assert_response :success assert_template "browse/history"