1 require File.dirname(__FILE__) + '/../test_helper'
2 require 'browse_controller'
4 # Re-raise errors caught by the controller.
5 class BrowseController; def rescue_action(e) raise e end; end
7 class BrowseControllerTest < Test::Unit::TestCase
13 @controller = BrowseController.new
14 @request = ActionController::TestRequest.new
15 @response = ActionController::TestResponse.new
18 def basic_authorization(user, pass)
19 @request.env["HTTP_AUTHORIZATION"] = "Basic %s" % Base64.encode64("#{user}:#{pass}")
23 @request.env["RAW_POST_DATA"] = c.to_s
26 # We need to load the home page, then activate the start rjs method
27 # and finally check that the new panel has loaded.
32 # This should display the last 20 nodes that were edited.
34 @nodes = Node.find(:all, :order => "timestamp DESC", :limit => 20)
35 assert @nodes.size <= 20
37 assert_response :success
38 assert_template "index"
39 # Now check that all 20 (or however many were returned) nodes are in the html
40 assert_select "h2", :text => "#{@nodes.size} Recently Changed Nodes", :count => 1
41 assert_select "ul[id='recently_changed'] li a", :count => @nodes.size
43 name = node.tags_as_hash['name'].to_s
44 name = "(No name)" if name.length == 0
45 assert_select "ul[id='recently_changed'] li a[href=/browse/node/#{node.id}]", :text => "#{name} - #{node.id} (#{node.version})"
49 # Test reading a relation
50 def test_read_relation
54 def test_read_relation_history
62 def test_read_way_history
70 def test_read_node_history
74 def test_read_changeset