Use a dedicated resource for showing cards in draft mode

Mobile team needs this. Also, this lets us get rid from some conditionals for handling
both modes with a single template.

https://3.basecamp.com/2914079/buckets/44843469/messages/9437287330
This commit is contained in:
Jorge Manrubia
2026-01-07 11:29:40 +01:00
parent de47e3d2a8
commit f58a1aeb31
12 changed files with 109 additions and 17 deletions
+9 -2
View File
@@ -21,7 +21,7 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
end
card = Card.last
assert_redirected_to card
assert_redirected_to card_draft_path(card)
assert card.drafted?
end
@@ -31,10 +31,17 @@ class CardsControllerTest < ActionDispatch::IntegrationTest
assert_no_difference -> { Card.count } do
post board_cards_path(boards(:writebook))
assert_redirected_to draft
assert_redirected_to card_draft_path(draft)
end
end
test "show redirects to draft when card is drafted" do
card = boards(:writebook).cards.create!(creator: users(:kevin), status: :drafted)
get card_path(card)
assert_redirected_to card_draft_path(card)
end
test "show" do
get card_path(cards(:logo))
assert_response :success