Fixed some minor bugs and add tests to spot them
This commit is contained in:
parent
c3bf919e3e
commit
abf3358ce5
5 changed files with 85 additions and 2 deletions
|
@ -214,10 +214,11 @@ class MapBugsController < ApplicationController
|
||||||
else
|
else
|
||||||
conditions = ['false']
|
conditions = ['false']
|
||||||
end
|
end
|
||||||
elsif request.format == :html
|
else #if request.format == :html
|
||||||
@title = t 'user.no_such_user.title'
|
@title = t 'user.no_such_user.title'
|
||||||
@not_found_user = params[:display_name]
|
@not_found_user = params[:display_name]
|
||||||
render :template => 'user/no_such_user', :status => :not_found
|
render :template => 'user/no_such_user', :status => :not_found
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ xml.rss("version" => "2.0",
|
||||||
if (comment.user.nil?)
|
if (comment.user.nil?)
|
||||||
xml.author comment.commenter_name
|
xml.author comment.commenter_name
|
||||||
else
|
else
|
||||||
xml.author comment.user.dislay_name
|
xml.author comment.user.display_name
|
||||||
end
|
end
|
||||||
|
|
||||||
xml.pubDate comment.date_created.to_s(:rfc822)
|
xml.pubDate comment.date_created.to_s(:rfc822)
|
||||||
|
|
50
test/fixtures/map_bug_comment.yml
vendored
50
test/fixtures/map_bug_comment.yml
vendored
|
@ -74,5 +74,55 @@ t8:
|
||||||
commenter_ip: '192.168.1.1'
|
commenter_ip: '192.168.1.1'
|
||||||
comment: 'Another valid comment for bug 5'
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
20
test/fixtures/map_bugs.yml
vendored
20
test/fixtures/map_bugs.yml
vendored
|
@ -47,3 +47,23 @@ bug_with_hidden_comment:
|
||||||
date_created: 2007-01-01 00:00:00
|
date_created: 2007-01-01 00:00:00
|
||||||
last_changed: 2007-03-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
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,18 @@ class MapBugsControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
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
|
def test_map_bug_comment_create_not_found
|
||||||
assert_no_difference('MapBugComment.count') do
|
assert_no_difference('MapBugComment.count') do
|
||||||
post :edit_bug, {:id => 12345, :name => "new_tester", :text => "This is an additional comment"}
|
post :edit_bug, {:id => 12345, :name => "new_tester", :text => "This is an additional comment"}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue