]> git.openstreetmap.org Git - rails.git/blobdiff - test/system/changeset_comments_test.rb
Update rubocop todo
[rails.git] / test / system / changeset_comments_test.rb
index 82fd81286ea4bb4d8c6dcce7c58ae2b949407c7f..b12aab5ee1057a466ac56a1d69103f7716b33fcd 100644 (file)
@@ -122,4 +122,41 @@ class ChangesetCommentsTest < ApplicationSystemTestCase
       assert_text "Wanted comment"
     end
   end
+
+  test "can subscribe" do
+    changeset = create(:changeset, :closed)
+    user = create(:user)
+    sign_in_as(user)
+    visit changeset_path(changeset)
+
+    within_sidebar do
+      assert_button "Subscribe"
+      assert_no_button "Unsubscribe"
+
+      click_on "Subscribe"
+
+      assert_no_button "Subscribe"
+      assert_button "Unsubscribe"
+    end
+  end
+
+  test "can't subscribe when blocked" do
+    changeset = create(:changeset, :closed)
+    user = create(:user)
+    sign_in_as(user)
+    visit changeset_path(changeset)
+    create(:user_block, :user => user)
+
+    within_sidebar do
+      assert_no_text "Your access to the API has been blocked"
+      assert_button "Subscribe"
+      assert_no_button "Unsubscribe"
+
+      click_on "Subscribe"
+
+      assert_text "Your access to the API has been blocked"
+      assert_button "Subscribe"
+      assert_no_button "Unsubscribe"
+    end
+  end
 end