minor improvement to the map_bugs tests
This commit is contained in:
parent
aa61dfb1ae
commit
4aec8dc3a5
2 changed files with 72 additions and 38 deletions
4
test/fixtures/map_bug_comment.yml
vendored
4
test/fixtures/map_bug_comment.yml
vendored
|
@ -54,9 +54,9 @@ t6:
|
||||||
date_created: 2007-01-01 00:00:00
|
date_created: 2007-01-01 00:00:00
|
||||||
commenter_name: 'testname'
|
commenter_name: 'testname'
|
||||||
commenter_ip: '192.168.1.1'
|
commenter_ip: '192.168.1.1'
|
||||||
comment: 'Valid Comment for bug 5'
|
comment: 'Valid comment for bug 5'
|
||||||
|
|
||||||
t6:
|
t7:
|
||||||
id: 7
|
id: 7
|
||||||
bug_id: 5
|
bug_id: 5
|
||||||
visible: false
|
visible: false
|
||||||
|
|
|
@ -10,36 +10,44 @@ class MapBugsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
id = @response.body.sub(/ok/,"").to_i
|
||||||
|
get :read, {:id => id, :format => 'json'}
|
||||||
|
assert_response :success
|
||||||
|
js = @response.body
|
||||||
|
assert_match "\"status\":\"open\"", js
|
||||||
|
assert_match "\"comment\":\"This is a comment\"", js
|
||||||
|
assert_match "\"commenter_name\":\"new_tester (a)\"", js
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_map_bug_comment_create_success
|
def test_map_bug_comment_create_success
|
||||||
assert_difference('MapBugComment.count') do
|
assert_difference('MapBugComment.count') do
|
||||||
post :edit_bug, {:id => 2, :name => "new_tester", :text => "This is an additional comment"}
|
post :edit_bug, {:id => 2, :name => "new_tester2", :text => "This is an additional comment"}
|
||||||
end
|
end
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
|
get :read, {:id => 2, :format => 'json'}
|
||||||
|
assert_response :success
|
||||||
|
js = @response.body
|
||||||
|
assert_match "\"id\":2", js
|
||||||
|
assert_match "\"status\":\"open\"", js
|
||||||
|
assert_match "\"comment\":\"This is an additional comment\"", js
|
||||||
|
assert_match "\"commenter_name\":\"new_tester2 (a)\"", js
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_map_bug_read_success
|
def test_map_bug_read_success
|
||||||
get :read, {:id => 1}
|
get :read, {:id => 1}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
|
||||||
|
|
||||||
def test_map_bug_read_xml_success
|
|
||||||
get :read, {:id => 1, :format => 'xml'}
|
get :read, {:id => 1, :format => 'xml'}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
|
||||||
|
|
||||||
def test_map_bug_read_rss_success
|
|
||||||
get :read, {:id => 1, :format => 'rss'}
|
get :read, {:id => 1, :format => 'rss'}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
|
||||||
|
|
||||||
def test_map_bug_read_json_success
|
|
||||||
get :read, {:id => 1, :format => 'json'}
|
get :read, {:id => 1, :format => 'json'}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
|
||||||
|
|
||||||
def test_map_bug_read_gpx_success
|
|
||||||
get :read, {:id => 1, :format => 'gpx'}
|
get :read, {:id => 1, :format => 'gpx'}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
@ -47,11 +55,28 @@ class MapBugsControllerTest < ActionController::TestCase
|
||||||
def test_map_bug_close_success
|
def test_map_bug_close_success
|
||||||
post :close_bug, {:id => 2}
|
post :close_bug, {:id => 2}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
|
get :read, {:id => 2, :format => 'json'}
|
||||||
|
js = @response.body
|
||||||
|
assert_match "\"id\":2", js
|
||||||
|
assert_match "\"status\":\"closed\"", js
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_bugs_success
|
def test_get_bugs_success
|
||||||
get :get_bugs, {:bbox=>'1,1,1.2,1.2'}
|
get :get_bugs, {:bbox=>'1,1,1.2,1.2'}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
|
get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'rss'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'json'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'xml'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'gpx'}
|
||||||
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_bugs_large_area_success
|
def test_get_bugs_large_area_success
|
||||||
|
@ -74,33 +99,31 @@ class MapBugsControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_bugs_rss_success
|
|
||||||
get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'rss'}
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_get_bugs_json_success
|
|
||||||
get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'json'}
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_get_bugs_xml_success
|
|
||||||
get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'xml'}
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_get_bugs_gpx_success
|
|
||||||
get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'gpx'}
|
|
||||||
assert_response :success
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_search_success
|
def test_search_success
|
||||||
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1'}
|
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1'}
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
|
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'xml'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'json'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'rss'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'gpx'}
|
||||||
|
assert_response :success
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_rss_success
|
||||||
|
get :rss, {:bbox=>'1,1,1.2,1.2'}
|
||||||
|
assert_response :success
|
||||||
|
|
||||||
|
get :rss
|
||||||
|
assert_response :success
|
||||||
|
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
|
||||||
|
@ -124,5 +147,16 @@ class MapBugsControllerTest < ActionController::TestCase
|
||||||
assert_response :gone
|
assert_response :gone
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_map_bug_hidden_comment
|
||||||
|
get :read, {:id => 5, :format => 'json'}
|
||||||
|
assert_response :success
|
||||||
|
js = @response.body
|
||||||
|
assert_match "\"id\":5", js
|
||||||
|
assert_match "\"comment\":\"Valid comment for bug 5\"", js
|
||||||
|
assert_match "\"comment\":\"Another valid comment for bug 5\"", js
|
||||||
|
assert_no_match /\"comment\":\"Spam for bug 5\"/, js
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue