]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/changesets_controller_test.rb
Order issue comments by id
[rails.git] / test / controllers / changesets_controller_test.rb
index 4274f7c313cc7856a6dceaae7a5a7c19babefea7..0f9c4b8ce72cb88b2bf3792b57eb9c17bccd9eb9 100644 (file)
@@ -82,6 +82,9 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest
     %w[-1 0 fred].each do |id|
       get history_path(:format => "html", :list => "1", :before => id)
       assert_redirected_to :controller => :errors, :action => :bad_request
+
+      get history_path(:format => "html", :list => "1", :after => id)
+      assert_redirected_to :controller => :errors, :action => :bad_request
     end
   end
 
@@ -238,6 +241,23 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest
     check_index_result [changeset1]
   end
 
+  def test_index_after_id
+    changeset1 = create(:changeset, :num_changes => 1)
+    changeset2 = create(:changeset, :num_changes => 1)
+
+    get history_path(:format => "html", :after => changeset1.id), :xhr => true
+    assert_response :success
+    assert_template "history"
+    assert_template :layout => "xhr"
+    assert_select "h2", :text => "Changesets", :count => 1
+
+    get history_path(:format => "html", :list => "1", :after => changeset1.id), :xhr => true
+    assert_response :success
+    assert_template "index"
+
+    check_index_result [changeset2]
+  end
+
   ##
   # Check that a list with a next page link works
   def test_index_more
@@ -259,7 +279,7 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest
     sidebar_browse_check :changeset_path, changeset.id, "changesets/show"
     assert_dom "h2", :text => "Changeset: #{changeset.id}"
     assert_dom "p", :text => "tested-changeset-comment"
-    assert_dom "li#c#{changeset_comment.id}" do
+    assert_dom "article#c#{changeset_comment.id}" do
       assert_dom "> small", :text => /^Comment from #{commenting_user.display_name}/
       assert_dom "a[href='#{user_path(commenting_user)}']"
     end
@@ -416,6 +436,11 @@ class ChangesetsControllerTest < ActionDispatch::IntegrationTest
     assert_redirected_to :action => :feed
   end
 
+  def test_feed_after
+    get history_feed_path(:format => "atom", :after => 100)
+    assert_redirected_to :action => :feed
+  end
+
   private
 
   ##