eb0614c44f
Passing a boolean vs using explicit on/off methods feel too low level and doesnt read right in most of these cases.
28 lines
802 B
Ruby
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
|