From: Kai Krueger Date: Sat, 27 Mar 2010 11:45:36 +0000 (+0000) Subject: Fixed some minor bugs and add tests to spot them X-Git-Tag: live~5114^2~217 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/abf3358ce505c7e67a92d895a6b5cd4a641855d9?hp=-c Fixed some minor bugs and add tests to spot them --- abf3358ce505c7e67a92d895a6b5cd4a641855d9 diff --git a/app/controllers/map_bugs_controller.rb b/app/controllers/map_bugs_controller.rb index 8412d17f3..41881cfb7 100644 --- a/app/controllers/map_bugs_controller.rb +++ b/app/controllers/map_bugs_controller.rb @@ -214,10 +214,11 @@ class MapBugsController < ApplicationController else conditions = ['false'] end - elsif request.format == :html + else #if request.format == :html @title = t 'user.no_such_user.title' @not_found_user = params[:display_name] render :template => 'user/no_such_user', :status => :not_found + return end end diff --git a/app/views/map_bugs/rss.rss.builder b/app/views/map_bugs/rss.rss.builder index 9fc6fd19c..a6487a024 100644 --- a/app/views/map_bugs/rss.rss.builder +++ b/app/views/map_bugs/rss.rss.builder @@ -36,7 +36,7 @@ xml.rss("version" => "2.0", if (comment.user.nil?) xml.author comment.commenter_name else - xml.author comment.user.dislay_name + xml.author comment.user.display_name end xml.pubDate comment.date_created.to_s(:rfc822) diff --git a/test/fixtures/map_bug_comment.yml b/test/fixtures/map_bug_comment.yml index 5ff9c36de..2214c0764 100644 --- a/test/fixtures/map_bug_comment.yml +++ b/test/fixtures/map_bug_comment.yml @@ -74,5 +74,55 @@ t8: commenter_ip: '192.168.1.1' comment: 'Another valid comment for bug 5' +t9: + id: 9 + bug_id: 6 + visible: true + date_created: 2007-01-01 00:00:00 + event: opened + commenter_id: 1 + comment: 'This is a bug with from a logged-in user' + + +t10: + id: 10 + bug_id: 6 + visible: true + date_created: 2007-02-01 00:00:00 + event: commented + commenter_id: 4 + comment: 'A comment from another logged-in user' + + +t11: + id: 11 + bug_id: 7 + visible: true + event: opened + date_created: 2007-01-01 00:00:00 + commenter_name: 'testname' + commenter_ip: '192.168.1.1' + comment: 'Initial bug description' + + +t12: + id: 12 + bug_id: 7 + visible: true + event: commented + date_created: 2007-02-01 00:00:00 + commenter_name: 'testname' + commenter_ip: '192.168.1.1' + comment: 'A comment description' + +t13: + id: 13 + bug_id: 7 + visible: true + event: closed + date_created: 2007-03-01 00:00:00 + commenter_id: 4 + + diff --git a/test/fixtures/map_bugs.yml b/test/fixtures/map_bugs.yml index c0f6f1fa8..7c465ab0f 100644 --- a/test/fixtures/map_bugs.yml +++ b/test/fixtures/map_bugs.yml @@ -47,3 +47,23 @@ bug_with_hidden_comment: date_created: 2007-01-01 00:00:00 last_changed: 2007-03-01 00:00:00 +bug_with_comments_by_users: + id: 6 + latitude: <%= 1.5*SCALE %> + longitude: <%= 1.5*SCALE %> + status: open + tile: <%= QuadTile.tile_for_point(1.5,1.5) %> + date_created: 2007-01-01 00:00:00 + last_changed: 2007-03-01 00:00:00 + + +bug_closed__by_user: + id: 7 + latitude: <%= 1.6*SCALE %> + longitude: <%= 1.6*SCALE %> + status: closed + tile: <%= QuadTile.tile_for_point(1.6,1.6) %> + date_created: 2007-01-01 00:00:00 + last_changed: 2007-03-01 00:00:00 + date_closed: 2007-03-01 00:00:00 + diff --git a/test/functional/map_bugs_controller_test.rb b/test/functional/map_bugs_controller_test.rb index b701e244e..c3335d2b1 100644 --- a/test/functional/map_bugs_controller_test.rb +++ b/test/functional/map_bugs_controller_test.rb @@ -125,6 +125,18 @@ class MapBugsControllerTest < ActionController::TestCase assert_response :success end + def test_user_bugs_success + get :my_bugs, {:display_name=>'test'} + assert_response :success + + get :my_bugs, {:display_name=>'pulibc_test2'} + assert_response :success + + get :my_bugs, {:display_name=>'non-existent'} + assert_response :not_found + + end + def test_map_bug_comment_create_not_found assert_no_difference('MapBugComment.count') do post :edit_bug, {:id => 12345, :name => "new_tester", :text => "This is an additional comment"}