Files
fizzy/test/models/bubble/watchable_test.rb
T
2025-02-26 10:53:03 +00:00

36 lines
969 B
Ruby

require "test_helper"
class Bubble::WatchableTest < ActiveSupport::TestCase
setup do
Watch.destroy_all
Subscription.destroy_all
end
test "watched_by?" do
assert_not bubbles(:logo).watched_by?(users(:kevin))
bubbles(:logo).set_watching(users(:kevin), true)
assert bubbles(:logo).watched_by?(users(:kevin))
bubbles(:logo).set_watching(users(:kevin), false)
assert_not bubbles(:logo).watched_by?(users(:kevin))
end
test "watched_by? when subscribed to the bucket" do
buckets(:writebook).subscribe(users(:kevin))
assert bubbles(:text).watched_by?(users(:kevin))
bubbles(:logo).set_watching(users(:kevin), false)
assert_not bubbles(:logo).watched_by?(users(:kevin))
end
test "bubbles are initially watched by their creator" do
buckets(:writebook).unsubscribe(users(:kevin))
bubble = buckets(:writebook).bubbles.create!(creator: users(:kevin))
assert bubble.watched_by?(users(:kevin))
end
end