]> git.openstreetmap.org Git - rails.git/commitdiff
Remove the changesets_subscribers fixture.
authorAndy Allan <git@gravitystorm.co.uk>
Sun, 30 Oct 2016 11:23:23 +0000 (12:23 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Sun, 30 Oct 2016 11:23:23 +0000 (12:23 +0100)
Since there is no ChangesetsSubscribers model, we can't use a factory.
Instead we create the associations explicitly when needed.

.rubocop_todo.yml
test/controllers/changeset_controller_test.rb
test/fixtures/changesets_subscribers.yml [deleted file]

index 95ddea8f893b186fa297cfddcc3a176a0aed2f71..83d561ef1f9a16827a9f652b9405b5f612976f3a 100644 (file)
@@ -64,7 +64,7 @@ Metrics/BlockNesting:
 # Offense count: 62
 # Configuration parameters: CountComments.
 Metrics/ClassLength:
-  Max: 1652
+  Max: 1658
 
 # Offense count: 69
 Metrics/CyclomaticComplexity:
index a9a838aff9da8749f41575ab78b32cad826ee2e3..e77083f2d0a169767c50ebc0ca3f675375a8cd74 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
@@ -1986,9 +1985,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
@@ -2004,7 +2009,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
@@ -2095,6 +2100,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
@@ -2106,6 +2112,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