Files
fizzy/test/controllers/bubbles/watches_controller_test.rb
T
David Heinemeier Hansson eb0614c44f Use a more ergonomic API for watching
Passing a boolean vs using explicit on/off methods feel too low level
and doesnt read right in most of these cases.
2025-04-06 19:17:26 +02:00

28 lines
802 B
Ruby

require "test_helper"
class Bubbles::WatchesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
end
test "create" do
bubbles(:logo).unwatch_by users(:kevin)
assert_changes -> { bubbles(:logo).watched_by?(users(:kevin)) }, from: false, to: true do
post bucket_bubble_watch_url(buckets(:writebook), bubbles(:logo))
end
assert_redirected_to bucket_bubble_watch_url(buckets(:writebook), bubbles(:logo))
end
test "destroy" do
bubbles(:logo).watch_by users(:kevin)
assert_changes -> { bubbles(:logo).watched_by?(users(:kevin)) }, from: true, to: false do
delete bucket_bubble_watch_url(buckets(:writebook), bubbles(:logo))
end
assert_redirected_to bucket_bubble_watch_url(buckets(:writebook), bubbles(:logo))
end
end