Files
fizzy/test/controllers/collections/publications_controller_test.rb
T
Mike Dalessio 4589360dd1 Collection publication edits render a turbo frame
so we don't disturb the rest of the edit page.
2025-07-02 22:25:09 -04:00

30 lines
824 B
Ruby

require "test_helper"
class Collections::PublicationsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
@collection = collections(:writebook)
end
test "publish a collection" do
assert_not @collection.published?
assert_changes -> { @collection.reload.published? }, from: false, to: true do
post collection_publication_path(@collection)
end
assert_turbo_stream action: :replace, target: dom_id(@collection, :publication)
end
test "unpublish a collection" do
@collection.publish
assert @collection.published?
assert_changes -> { @collection.reload.published? }, from: true, to: false do
delete collection_publication_path(@collection)
end
assert_turbo_stream action: :replace, target: dom_id(@collection, :publication)
end
end