Allow managing bucket subscriptions

This commit is contained in:
Kevin McConnell
2025-02-25 13:12:57 +00:00
parent f22742c431
commit a802b8de5a
6 changed files with 67 additions and 16 deletions
@@ -0,0 +1,25 @@
require "test_helper"
class Buckets::SubscriptionsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :jz
end
test "subscribing to a bucket" do
assert_changes -> { buckets(:writebook).subscribed_by?(users(:jz)) }, from: false, to: true do
put bucket_subscriptions_url(buckets(:writebook)), params: { subscribed: "1" }
end
assert_response :success
end
test "unsubscribing from a bucket" do
buckets(:writebook).subscribe(users(:jz))
assert_changes -> { buckets(:writebook).subscribed_by?(users(:jz)) }, from: true, to: false do
put bucket_subscriptions_url(buckets(:writebook)), params: { subscribed: "0" }
end
assert_response :success
end
end