]> git.openstreetmap.org Git - rails.git/blob - test/functional/map_bugs_controller_test.rb
8031041bd2af5aa200dbaca3d4e2fb988c74926d
[rails.git] / test / functional / map_bugs_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class MapBugsControllerTest < ActionController::TestCase
4   fixtures :users, :map_bugs, :map_bug_comment
5     
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"}
10           end
11         end
12     assert_response :success      
13   end
14
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"}
18     end
19     assert_response :success      
20   end
21
22   def test_map_bug_read_success
23     get :read, {:id => 1}
24     assert_response :success      
25   end
26
27   def test_map_bug_read_xml_success
28     get :read, {:id => 1,  :format => 'xml'}
29     assert_response :success      
30   end
31
32   def test_map_bug_read_rss_success
33     get :read, {:id => 1,  :format => 'rss'}
34     assert_response :success      
35   end
36
37   def test_map_bug_read_json_success
38     get :read, {:id => 1,  :format => 'json'}
39     assert_response :success      
40   end
41
42   def test_map_bug_read_gpx_success
43     get :read, {:id => 1,  :format => 'gpx'}
44     assert_response :success
45   end
46
47   def test_map_bug_close_success
48         post :close_bug, {:id => 2}
49     assert_response :success      
50   end
51
52   def test_get_bugs_success
53         get :get_bugs, {:bbox=>'1,1,1.2,1.2'}
54         assert_response :success
55   end
56
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
60   end
61
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
65   end
66
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
70   end
71
72   def test_get_bugs_rss_success
73         get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'rss'}
74         assert_response :success
75   end
76
77   def test_get_bugs_json_success
78         get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'json'}
79         assert_response :success
80   end
81
82   def test_get_bugs_xml_success
83         get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'xml'}
84         assert_response :success
85   end
86
87   def test_get_bugs_gpx_success
88         get :get_bugs, {:bbox=>'1,1,1.2,1.2', :format => 'gpx'}
89         assert_response :success
90   end
91
92
93
94   def test_search_success
95         get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1'}
96         assert_response :success
97   end
98
99
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"}
103     end
104     assert_response :not_found
105   end
106
107   def test_map_bug_close_not_found
108         post :close_bug, {:id => 12345}
109     assert_response :not_found
110   end
111
112   def test_map_bug_read_not_found
113         get :read, {:id => 12345}
114     assert_response :not_found
115   end
116
117   def test_map_bug_read_gone
118         get :read, {:id => 4}
119     assert_response :gone
120   end
121
122   
123 end