Files
fizzy/test/controllers/public/boards_controller_test.rb
Mike Dalessio e27c0c5fa1 Filter draft cards from public closed column (#2667)
The public closed column was showing draft cards because it queried
`@board.cards.closed` without a `.published` filter. This adds the
missing `.published` scope to match the pattern used elsewhere in the
public controllers.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 20:31:41 -05:00

40 lines
954 B
Ruby

require "test_helper"
class Public::BoardsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
boards(:writebook).publish
end
test "show" do
get published_board_path(boards(:writebook))
assert_response :success
end
test "not found if the board is not published" do
key = boards(:writebook).publication.key
boards(:writebook).unpublish
get public_board_path(key)
assert_response :not_found
end
test "show excludes draft cards from closed count" do
draft_card = cards(:buy_domain)
draft_card.update!(status: :drafted)
Current.set(user: users(:david)) { draft_card.close }
get published_board_path(boards(:writebook))
assert_response :success
assert_select ".cards--closed .cards__expander-count", "1"
end
test "show works without authentication" do
sign_out
get published_board_path(boards(:writebook))
assert_response :success
end
end