Merge remote-tracking branch 'openstreetmap/pull/1352'
authorTom Hughes <tom@compton.nu>
Sun, 30 Oct 2016 16:59:20 +0000 (16:59 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 30 Oct 2016 16:59:20 +0000 (16:59 +0000)
.rubocop_todo.yml
test/controllers/changeset_controller_test.rb
test/fixtures/changesets_subscribers.yml [deleted file]

index b5834b8ce4ad2f968579b137f07bcfe8d23108e0..f1e93f25bfb4cca9988b86bdde67827752574757 100644 (file)
@@ -64,7 +64,7 @@ Metrics/BlockNesting:
 # Offense count: 62
 # Configuration parameters: CountComments.
 Metrics/ClassLength:
-  Max: 1653
+  Max: 1659
 
 # Offense count: 69
 Metrics/CyclomaticComplexity:
index 5744ed9abbd8f24f7f3ccd385d0b9f4e288c9eea..efdf22e54f8b25ad7d2c5613098054dc342fdc26 100644 (file)
@@ -3,7 +3,6 @@ require "changeset_controller"
 
 class ChangesetControllerTest < ActionController::TestCase
   api_fixtures
-  fixtures :changesets_subscribers
 
   ##
   # test all routes which lead to this controller
@@ -1987,9 +1986,15 @@ EOF
     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
-        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
@@ -2005,7 +2010,7 @@ EOF
 
     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
@@ -2096,6 +2101,7 @@ EOF
 
     # 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
@@ -2107,6 +2113,7 @@ EOF
   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
diff --git a/test/fixtures/changesets_subscribers.yml b/test/fixtures/changesets_subscribers.yml
deleted file mode 100644 (file)
index c752878..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-t1:
-  changeset_id: 8
-  subscriber_id: 2
-
-t2:
-  changeset_id: 8
-  subscriber_id: 1
-
-t3:
-  changeset_id: 8
-  subscriber_id: 10
-
-t4:
-  changeset_id: 8
-  subscriber_id: 11