X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0d3a9ed9cb47ce3b89ea9eaffbb589f9a9ff6d22..8482a525c0243cfaff7e65d836075c98fed42e3a:/test/functional/changeset_controller_test.rb diff --git a/test/functional/changeset_controller_test.rb b/test/functional/changeset_controller_test.rb index 21cae1f00..69811ad59 100644 --- a/test/functional/changeset_controller_test.rb +++ b/test/functional/changeset_controller_test.rb @@ -56,25 +56,13 @@ class ChangesetControllerTest < ActionController::TestCase { :controller => "changeset", :action => "list", :nearby => true } ) assert_routing( - { :path => "/browse/changesets", :method => :get }, + { :path => "/history", :method => :get }, { :controller => "changeset", :action => "list" } ) assert_routing( - { :path => "/browse/changesets/feed", :method => :get }, + { :path => "/history/feed", :method => :get }, { :controller => "changeset", :action => "feed", :format => :atom } ) - assert_recognizes( - { :controller => "changeset", :action => "list" }, - { :path => "/browse", :method => :get } - ) - assert_recognizes( - { :controller => "changeset", :action => "list" }, - { :path => "/history", :method => :get } - ) - assert_recognizes( - { :controller => "changeset", :action => "feed", :format => :atom }, - { :path => "/history/feed", :method => :get } - ) end # ----------------------- @@ -175,7 +163,7 @@ class ChangesetControllerTest < ActionController::TestCase begin get :read, :id => id assert_response :not_found, "should get a not found" - rescue ActionController::RoutingError => ex + rescue ActionController::UrlGenerationError => ex assert_match /No route matches/, ex.to_s end end @@ -241,7 +229,7 @@ class ChangesetControllerTest < ActionController::TestCase begin put :close, :id => id assert_response :unauthorized, "Shouldn't be able close the non-existant changeset #{id}, when not authorized" - rescue ActionController::RoutingError => ex + rescue ActionController::UrlGenerationError => ex assert_match /No route matches/, ex.to_s end end @@ -252,7 +240,7 @@ class ChangesetControllerTest < ActionController::TestCase begin put :close, :id => id assert_response :not_found, "The changeset #{id} doesn't exist, so can't be closed" - rescue ActionController::RoutingError => ex + rescue ActionController::UrlGenerationError => ex assert_match /No route matches/, ex.to_s end end @@ -1728,14 +1716,23 @@ EOF ## # This should display the last 20 changesets closed. def test_list - changesets = Changeset.find(:all, :order => "created_at DESC", :conditions => ['num_changes > 0'], :limit=> 20) - assert changesets.size <= 20 get :list, {:format => "html"} assert_response :success + assert_template "changeset/history" + assert_select "h2", :text => "Changesets", :count => 1 + + get :list, {:format => "html", :bbox => '-180,-90,90,180'} + assert_response :success assert_template "list" + + changesets = Changeset. + where("num_changes > 0 and min_lon is not null"). + order(:created_at => :desc). + limit(20) + assert changesets.size <= 20 + # Now check that all 20 (or however many were returned) changesets are in the html - assert_select "h1", :text => "Changesets", :count => 1 - assert_select "table[id='changeset_list'] tr", :count => changesets.size + assert_select "li", :count => changesets.size changesets.each do |changeset| # FIXME this test needs rewriting - test for table contents end @@ -1747,7 +1744,7 @@ EOF user = users(:public_user) get :list, {:format => "html", :display_name => user.display_name} assert_response :success - assert_template "changeset/_user" + assert_template "changeset/history" ## FIXME need to add more checks to see which if edits are actually shown if your data is public end @@ -1762,7 +1759,7 @@ EOF ## # This should display the last 20 changesets closed. def test_feed - changesets = Changeset.find(:all, :order => "created_at DESC", :conditions => ['num_changes > 0'], :limit=> 20) + changesets = Changeset.where("num_changes > 0").order(:created_at => :desc).limit(20) assert changesets.size <= 20 get :feed, {:format => "atom"} assert_response :success @@ -1781,7 +1778,8 @@ EOF user = users(:public_user) get :feed, {:format => "atom", :display_name => user.display_name} assert_response :success - assert_template "changeset/_user" + assert_template "changeset/list" + assert_equal "application/atom+xml", response.content_type ## FIXME need to add more checks to see which if edits are actually shown if your data is public end