Add API for postponing cards

This commit is contained in:
Stanko K.R.
2025-12-05 15:03:32 +01:00
parent 52e65b3c08
commit 8a61ca2a79
2 changed files with 17 additions and 2 deletions
+5 -1
View File
@@ -3,6 +3,10 @@ class Cards::NotNowsController < ApplicationController
def create
@card.postpone
render_card_replacement
respond_to do |format|
format.turbo_stream { render_card_replacement }
format.json { head :no_content }
end
end
end
@@ -9,8 +9,19 @@ class Cards::NotNowsControllerTest < ActionDispatch::IntegrationTest
card = cards(:logo)
assert_changes -> { card.reload.postponed? }, from: false, to: true do
post card_not_now_path(card)
post card_not_now_path(card), as: :turbo_stream
assert_card_container_rerendered(card)
end
end
test "create as JSON" do
card = cards(:logo)
assert_not card.postponed?
post card_not_now_path(card), as: :json
assert_response :no_content
assert card.reload.postponed?
end
end