1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'browse_controller'
4 class BrowseControllerTest < ActionController::TestCase
9 assert_response :success
12 def test_read_relation
13 browse_check 'relation', relations(:visible_relation).relation_id
16 def test_read_relation_history
17 browse_check 'relation_history', relations(:visible_relation).relation_id
21 browse_check 'way', ways(:visible_way).way_id
24 def test_read_way_history
25 browse_check 'way_history', ways(:visible_way).way_id
29 browse_check 'node', nodes(:visible_node).node_id
32 def test_read_node_history
33 browse_check 'node_history', nodes(:visible_node).node_id
36 def test_read_changeset
37 browse_check 'changeset', changesets(:normal_user_first_change).id
40 # This is a convenience method for most of the above checks
41 # First we check that when we don't have an id, it will correctly return a 404
42 # then we check that we get the correct 404 when a non-existant id is passed
43 # then we check that it will get a successful response, when we do pass an id
44 def browse_check(type, id)
46 assert_response :not_found
47 assert_template 'not_found'
48 get type, {:id => -10} # we won't have an id that's negative
49 assert_response :not_found
50 assert_template 'not_found'
52 assert_response :success