Add drafted and published states

This commit is contained in:
Kevin McConnell
2025-01-07 17:13:56 +00:00
parent f209c23e45
commit cd1e6378d0
13 changed files with 69 additions and 8 deletions
+20
View File
@@ -0,0 +1,20 @@
require "test_helper"
class Bubble::DraftableTest < ActiveSupport::TestCase
test "bubbles are only visible to the creator by default" do
bubble = buckets(:writebook).bubbles.create! creator: users(:kevin), title: "Drafted Bubble"
assert bubble.drafted?
assert_includes Bubble.published_or_drafted_by(users(:kevin)), bubble
assert_not_includes Bubble.published_or_drafted_by(users(:jz)), bubble
end
test "bubbles are visible to everyone when published" do
bubble = buckets(:writebook).bubbles.create! creator: users(:kevin), title: "Drafted Bubble"
bubble.published!
assert bubble.published?
assert_includes Bubble.published_or_drafted_by(users(:kevin)), bubble
assert_includes Bubble.published_or_drafted_by(users(:jz)), bubble
end
end