+ # Checks the display of the friends changesets listing
+ def test_list_friends
+ user = users(:normal_user)
+
+ get :list, :friends => true
+ assert_response :redirect
+ assert_redirected_to :controller => :user, :action => :login, :referer => friend_changesets_path
+
+ session[:user] = user.id
+
+ get :list, :friends => true
+ assert_response :success
+ assert_template "history"
+
+ xhr :get, :list, :friends => true, :list => "1"
+ assert_response :success
+ assert_template "list"
+
+ check_list_result(Changeset.where(:user => user.friend_users.identifiable))
+ end
+
+ ##
+ # Checks the display of the nearby user changesets listing
+ def test_list_nearby
+ user = users(:normal_user)
+
+ get :list, :nearby => true
+ assert_response :redirect
+ assert_redirected_to :controller => :user, :action => :login, :referer => nearby_changesets_path
+
+ session[:user] = user.id
+
+ get :list, :nearby => true
+ assert_response :success
+ assert_template "history"
+
+ xhr :get, :list, :nearby => true, :list => "1"
+ assert_response :success
+ assert_template "list"
+
+ check_list_result(Changeset.where(:user => user.nearby))
+ end
+
+ ##
+ # Check that we can't request later pages of the changesets list
+ def test_list_max_id
+ xhr :get, :list, :format => "html", :max_id => 4
+ assert_response :success
+ assert_template "history"
+ assert_template :layout => "xhr"
+ assert_select "h2", :text => "Changesets", :count => 1
+
+ xhr :get, :list, :format => "html", :list => "1", :max_id => 4
+ assert_response :success
+ assert_template "list"
+
+ check_list_result(Changeset.where("id <= 4"))
+ end
+
+ ##
+ # This should display the last 20 changesets closed