1 require File.dirname(__FILE__) + '/../test_helper'
3 class MapBugsControllerTest < ActionController::TestCase
4 fixtures :users, :map_bugs, :map_bug_comment
6 def test_map_bug_create_success
7 assert_difference('MapBug.count') do
8 assert_difference('MapBugComment.count') do
9 post :add_bug, {:lat => -1.0, :lon => -1.0, :name => "new_tester", :text => "This is a comment"}
12 assert_response :success
15 def test_map_bug_comment_create_success
16 assert_difference('MapBugComment.count') do
17 post :edit_bug, {:id => 2, :name => "new_tester", :text => "This is an additional comment"}
19 assert_response :success
22 def test_map_bug_read_success
24 assert_response :success
27 def test_map_bug_read_xml_success
28 get :read, {:id => 1, :format => 'xml'}
29 assert_response :success
32 def test_map_bug_read_rss_success
33 get :read, {:id => 1, :format => 'rss'}
34 assert_response :success
37 def test_map_bug_read_json_success
38 get :read, {:id => 1, :format => 'json'}
39 assert_response :success
42 def test_map_bug_read_gpx_success
43 get :read, {:id => 1, :format => 'gpx'}
44 assert_response :success
47 def test_map_bug_close_success
48 post :close_bug, {:id => 2}
49 assert_response :success
52 def test_get_bugs_success
53 get :get_bugs, {:bbox=>'1,1,1.2,1.2'}
54 assert_response :success
57 def test_get_bugs_closed_7_success
58 get :get_bugs, {:bbox=>'1,1,1.2,1.2', :closed => '7'}
59 assert_response :success
62 def test_get_bugs_closed_0_success
63 get :get_bugs, {:bbox=>'1,1,1.2,1.2', :closed => '0'}
64 assert_response :success
67 def test_get_bugs_closed_n1_success
68 get :get_bugs, {:bbox=>'1,1,1.2,1.2', :closed => '-1'}
69 assert_response :success
72 def test_get_bugs_rss_success
73 get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'rss'}
74 assert_response :success
77 def test_get_bugs_json_success
78 get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'json'}
79 assert_response :success
82 def test_get_bugs_xml_success
83 get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'xml'}
84 assert_response :success
87 def test_get_bugs_gpx_success
88 get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'gpx'}
89 assert_response :success
94 def test_search_success
95 get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1'}
96 assert_response :success
100 def test_map_bug_comment_create_not_found
101 assert_no_difference('MapBugComment.count') do
102 post :edit_bug, {:id => 12345, :name => "new_tester", :text => "This is an additional comment"}
104 assert_response :not_found
107 def test_map_bug_close_not_found
108 post :close_bug, {:id => 12345}
109 assert_response :not_found
112 def test_map_bug_read_not_found
113 get :read, {:id => 12345}
114 assert_response :not_found
117 def test_map_bug_read_gone
118 get :read, {:id => 4}
119 assert_response :gone