+ assert_template "user/no_such_user"
+
+ get :index, :params => { :format => "html", :display_name => "Some random user", :list => "1" }, :xhr => true
+ assert_response :not_found
+ assert_template "user/no_such_user"
+ end
+
+ ##
+ # Checks the display of the friends changesets listing
+ def test_index_friends
+ private_user = create(:user, :data_public => true)
+ friend = create(:friend, :befriender => private_user)
+ create(:changeset, :user => friend.befriendee)
+
+ get :index, :params => { :friends => true }
+ assert_response :redirect
+ assert_redirected_to :controller => :user, :action => :login, :referer => friend_changesets_path
+
+ session[:user] = private_user.id
+
+ get :index, :params => { :friends => true }
+ assert_response :success
+ assert_template "history"
+
+ get :index, :params => { :friends => true, :list => "1" }, :xhr => true
+ assert_response :success
+ assert_template "index"
+
+ check_index_result(Changeset.where(:user => private_user.friend_users.identifiable))
+ end
+
+ ##
+ # Checks the display of the nearby user changesets listing
+ def test_index_nearby
+ private_user = create(:user, :data_public => false, :home_lat => 51.1, :home_lon => 1.0)
+ user = create(:user, :home_lat => 51.0, :home_lon => 1.0)
+ create(:changeset, :user => user)
+
+ get :index, :params => { :nearby => true }
+ assert_response :redirect
+ assert_redirected_to :controller => :user, :action => :login, :referer => nearby_changesets_path
+
+ session[:user] = private_user.id
+
+ get :index, :params => { :nearby => true }
+ assert_response :success
+ assert_template "history"
+
+ get :index, :params => { :nearby => true, :list => "1" }, :xhr => true
+ assert_response :success
+ assert_template "index"
+
+ check_index_result(Changeset.where(:user => user.nearby))