   ,
     (test, expect) ->
       testSetEqual test, _.pluck(Posts.find().fetch(), '_id'), []
-      test.equal Counts.findOne()?.count, 0
+      test.equal Counts.findOne(@countId)?.count, 0
   ]
+
+  testAsyncMulti 'related - unsubscribing', [
+    (test, expect) ->
+      @userId = Random.id()
+      @countId = Random.id()
+
+      @usersPostsSubscribe = Meteor.subscribe 'users-posts', @userId, expect()
+      @usersPostsCount = Meteor.subscribe 'users-posts-count', @userId, @countId, expect()
+  ,
+    (test, expect) ->
+      test.equal Posts.find().fetch(), []
+      test.equal Counts.findOne(@countId)?.count, 0
+
+      @posts = []
+
+      for i in [0...10]
+        Posts.insert {}, expect (error, id) =>
+          test.isFalse error, error?.toString?() or error
+          test.isTrue id
+          @posts.push id
+  ,
+    (test, expect) ->
+      test.equal Posts.find().fetch(), []
+      test.equal Counts.findOne(@countId)?.count, 0
+
+      Users.insert
+        _id: @userId
+        posts: @posts
+      ,
+        expect (error, userId) =>
+          test.isFalse error, error?.toString?() or error
+          test.isTrue userId
+          test.equal userId, @userId
+  ,
+    (test, expect) ->
+      Posts.find().forEach (post) ->
+        test.isTrue post.dummyField, true
+      testSetEqual test, _.pluck(Posts.find().fetch(), '_id'), @posts
+      test.equal Counts.findOne(@countId)?.count, @posts.length
+
+      Meteor.subscribe 'posts', @posts, expect()
+      @usersPostsSubscribe.stop()
+  ,
+    (test, expect) ->
+      # After unsubscribing from the related-based publish which added dummyField,
+      # dummyField should be removed from documents available on the client side
+      Posts.find().forEach (post) ->
+        test.isUndefined post.dummyField
+      testSetEqual test, _.pluck(Posts.find().fetch(), '_id'), @posts
+
+  ]

  ,
    (test, expect) ->
      testSetEqual test, _.pluck(Posts.find().fetch(), '_id'), []
      test.equal Counts.findOne()?.count, 0

      Users.update @userId,
        posts: @posts

          test.equal count, 1
  ,
    (test, expect) ->
      Posts.find().forEach (post) ->
        test.isTrue post.dummyField, true
      testSetEqual test, _.pluck(Posts.find().fetch(), '_id'), @shortPosts
      test.equal Counts.findOne(@countId)?.count, @shortPosts.length

      Users.update @userId,
        posts: []
