]> git.openstreetmap.org Git - rails.git/blobdiff - test/functional/note_controller_test.rb
Update tests for change in name from "map_bug" to "note" etc
[rails.git] / test / functional / note_controller_test.rb
similarity index 70%
rename from test/functional/map_bugs_controller_test.rb
rename to test/functional/note_controller_test.rb
index b88f2608a25a959f08f5486649b1e3bbd6ae7dd4..955f1c24c605ef86ae66ff97866c84f7ac907945 100644 (file)
@@ -1,11 +1,11 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
-class MapBugsControllerTest < ActionController::TestCase
-  fixtures :users, :map_bugs, :map_bug_comment
-    
-  def test_map_bug_create_success
-    assert_difference('MapBug.count') do
-      assert_difference('MapBugComment.count') do
+class NoteControllerTest < ActionController::TestCase
+  fixtures :users, :notes, :note_comments
+
+  def test_map_note_create_success
+    assert_difference('Note.count') do
+      assert_difference('NoteComment.count') do
         post :create, {:lat => -1.0, :lon => -1.0, :name => "new_tester", :text => "This is a comment"}
       end
     end
@@ -19,8 +19,8 @@ class MapBugsControllerTest < ActionController::TestCase
     assert_match "\"author_name\":\"new_tester (a)\"", js
   end
 
-  def test_map_bug_comment_create_success
-    assert_difference('MapBugComment.count') do
+  def test_map_note_comment_create_success
+    assert_difference('NoteComment.count') do
       post :update, {:id => 2, :name => "new_tester2", :text => "This is an additional comment"}
     end
     assert_response :success
@@ -34,7 +34,7 @@ class MapBugsControllerTest < ActionController::TestCase
     assert_match "\"author_name\":\"new_tester2 (a)\"", js
   end
 
-  def test_map_bug_read_success
+  def test_map_note_read_success
     get :read, {:id => 1}
     assert_response :success      
 
@@ -51,7 +51,7 @@ class MapBugsControllerTest < ActionController::TestCase
     assert_response :success
   end
 
-  def test_map_bug_close_success
+  def test_map_note_close_success
     post :close, {:id => 2}
     assert_response :success
 
@@ -61,7 +61,7 @@ class MapBugsControllerTest < ActionController::TestCase
     assert_match "\"status\":\"closed\"", js
   end
 
-  def test_get_bugs_success
+  def test_get_notes_success
     get :list, {:bbox=>'1,1,1.2,1.2'}
     assert_response :success
 
@@ -78,46 +78,46 @@ class MapBugsControllerTest < ActionController::TestCase
     assert_response :success
   end
 
-  def test_get_bugs_large_area_success
+  def test_get_notes_large_area_success
     get :list, {:bbox=>'-2.5,-2.5,2.5,2.5'}
     assert_response :success
   end
 
-  def test_get_bugs_large_area_bad_request
+  def test_get_notes_large_area_bad_request
     get :list, {:bbox=>'-10,-10,12,12'}
     assert_response :bad_request
   end
 
-  def test_get_bugs_closed_7_success
+  def test_get_notes_closed_7_success
     get :list, {:bbox=>'1,1,1.2,1.2', :closed => '7'}
     assert_response :success
   end
 
-  def test_get_bugs_closed_0_success
+  def test_get_notes_closed_0_success
     get :list, {:bbox=>'1,1,1.2,1.2', :closed => '0'}
     assert_response :success
   end
 
-  def test_get_bugs_closed_n1_success
+  def test_get_notes_closed_n1_success
     get :list, {:bbox=>'1,1,1.2,1.2', :closed => '-1'}
     assert_response :success
   end
 
 
   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 => 'note 1'}
     assert_response :success
 
-    get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'xml'}
+    get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1', :format => 'xml'}
     assert_response :success
 
-    get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'json'}
+    get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1', :format => 'json'}
     assert_response :success
 
-    get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'rss'}
+    get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1', :format => 'rss'}
     assert_response :success
 
-    get :search, {:bbox=>'1,1,1.2,1.2', :q => 'bug 1', :format => 'gpx'}
+    get :search, {:bbox=>'1,1,1.2,1.2', :q => 'note 1', :format => 'gpx'}
     assert_response :success
   end
 
@@ -129,7 +129,7 @@ class MapBugsControllerTest < ActionController::TestCase
     assert_response :success
   end
 
-  def test_user_bugs_success
+  def test_user_notes_success
     get :mine, {:display_name=>'test'}
     assert_response :success
 
@@ -140,35 +140,35 @@ class MapBugsControllerTest < ActionController::TestCase
     assert_response :not_found 
   end
 
-  def test_map_bug_comment_create_not_found
-    assert_no_difference('MapBugComment.count') do
+  def test_map_note_comment_create_not_found
+    assert_no_difference('NoteComment.count') do
       post :update, {:id => 12345, :name => "new_tester", :text => "This is an additional comment"}
     end
     assert_response :not_found
   end
 
-  def test_map_bug_close_not_found
+  def test_map_note_close_not_found
     post :close, {:id => 12345}
     assert_response :not_found
   end
 
-  def test_map_bug_read_not_found
+  def test_map_note_read_not_found
     get :read, {:id => 12345}
     assert_response :not_found
   end
 
-  def test_map_bug_read_gone
+  def test_map_note_read_gone
     get :read, {:id => 4}
     assert_response :gone
   end
 
-  def test_map_bug_hidden_comment
+  def test_map_note_hidden_comment
     get :read, {:id => 5, :format => 'json'}
     assert_response :success
     js = @response.body
     assert_match "\"id\":5", js
-    assert_match "\"body\":\"Valid comment for bug 5\"", js
-    assert_match "\"body\":\"Another valid comment for bug 5\"", js
-    assert_no_match /\"body\":\"Spam for bug 5\"/, js
+    assert_match "\"body\":\"Valid comment for note 5\"", js
+    assert_match "\"body\":\"Another valid comment for note 5\"", js
+    assert_no_match /\"body\":\"Spam for note 5\"/, js
   end
 end