Add JSON response format to board publication toggle (#2663)

This commit is contained in:
Rob Zolkos
2026-03-05 20:48:03 -05:00
committed by GitHub
parent e27c0c5fa1
commit e47f2d93eb
5 changed files with 103 additions and 1 deletions
@@ -250,6 +250,24 @@ class BoardsControllerTest < ActionDispatch::IntegrationTest
assert_equal boards(:writebook).name, @response.parsed_body["name"]
end
test "show as JSON includes public_url when published" do
board = boards(:writebook)
board.publish
get board_path(board), as: :json
assert_response :success
assert_equal published_board_url(board), @response.parsed_body["public_url"]
end
test "show as JSON excludes public_url when not published" do
board = boards(:writebook)
assert_not board.published?
get board_path(board), as: :json
assert_response :success
assert_nil @response.parsed_body["public_url"]
end
test "create as JSON" do
assert_difference -> { Board.count }, +1 do
post boards_path, params: { board: { name: "My new board" } }, as: :json