]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/changeset_controller_test.rb
Stub nominatim for reverse lookups in note tests
[rails.git] / test / controllers / changeset_controller_test.rb
index a9a838aff9da8749f41575ab78b32cad826ee2e3..efdf22e54f8b25ad7d2c5613098054dc342fdc26 100644 (file)
@@ -3,7 +3,6 @@ require "changeset_controller"
 
 class ChangesetControllerTest < ActionController::TestCase
   api_fixtures
 
 class ChangesetControllerTest < ActionController::TestCase
   api_fixtures
-  fixtures :changesets_subscribers
 
   ##
   # test all routes which lead to this controller
 
   ##
   # test all routes which lead to this controller
@@ -1649,6 +1648,7 @@ EOF
 
     ## Now try with the public user
     changeset = changesets(:public_user_first_change)
 
     ## Now try with the public user
     changeset = changesets(:public_user_first_change)
+    create(:changeset_tag, :changeset => changeset)
     new_changeset = changeset.to_xml
     new_tag = XML::Node.new "tag"
     new_tag["k"] = "tagtesting"
     new_changeset = changeset.to_xml
     new_tag = XML::Node.new "tag"
     new_tag["k"] = "tagtesting"
@@ -1986,9 +1986,15 @@ EOF
     end
     assert_response :success
 
     end
     assert_response :success
 
+    changeset = changesets(:normal_user_subscribed_change)
+    changeset.subscribers.push(users(:normal_user))
+    changeset.subscribers.push(users(:public_user))
+    changeset.subscribers.push(users(:suspended_user))
+    changeset.subscribers.push(users(:deleted_user))
+
     assert_difference "ChangesetComment.count", 1 do
       assert_difference "ActionMailer::Base.deliveries.size", 1 do
     assert_difference "ChangesetComment.count", 1 do
       assert_difference "ActionMailer::Base.deliveries.size", 1 do
-        post :comment, :id => changesets(:normal_user_subscribed_change).id, :text => "This is a comment"
+        post :comment, :id => changeset.id, :text => "This is a comment"
       end
     end
     assert_response :success
       end
     end
     assert_response :success
@@ -2004,7 +2010,7 @@ EOF
 
     assert_difference "ChangesetComment.count", 1 do
       assert_difference "ActionMailer::Base.deliveries.size", 2 do
 
     assert_difference "ChangesetComment.count", 1 do
       assert_difference "ActionMailer::Base.deliveries.size", 2 do
-        post :comment, :id => changesets(:normal_user_subscribed_change).id, :text => "This is a comment"
+        post :comment, :id => changeset.id, :text => "This is a comment"
       end
     end
     assert_response :success
       end
     end
     assert_response :success
@@ -2095,6 +2101,7 @@ EOF
 
     # trying to subscribe when already subscribed
     changeset = changesets(:normal_user_subscribed_change)
 
     # trying to subscribe when already subscribed
     changeset = changesets(:normal_user_subscribed_change)
+    changeset.subscribers.push(users(:public_user))
     assert_no_difference "changeset.subscribers.count" do
       post :subscribe, :id => changeset.id
     end
     assert_no_difference "changeset.subscribers.count" do
       post :subscribe, :id => changeset.id
     end
@@ -2106,6 +2113,7 @@ EOF
   def test_unsubscribe_success
     basic_authorization(users(:public_user).email, "test")
     changeset = changesets(:normal_user_subscribed_change)
   def test_unsubscribe_success
     basic_authorization(users(:public_user).email, "test")
     changeset = changesets(:normal_user_subscribed_change)
+    changeset.subscribers.push(users(:public_user))
 
     assert_difference "changeset.subscribers.count", -1 do
       post :unsubscribe, :id => changeset.id
 
     assert_difference "changeset.subscribers.count", -1 do
       post :unsubscribe, :id => changeset.id