Add API for tagging cards

This commit is contained in:
Stanko K.R.
2025-12-05 15:36:09 +01:00
parent c517ef6063
commit 8a84785056
2 changed files with 27 additions and 0 deletions
@@ -23,4 +23,26 @@ class Cards::TaggingsControllerTest < ActionDispatch::IntegrationTest
assert_turbo_stream action: :replace, target: dom_id(cards(:logo), :tags)
end
end
test "toggle tag on as JSON" do
card = cards(:logo)
assert_not card.tagged_with?(tags(:mobile))
post card_taggings_path(card), params: { tag_title: tags(:mobile).title }, as: :json
assert_response :no_content
assert card.reload.tagged_with?(tags(:mobile))
end
test "toggle tag off as JSON" do
card = cards(:logo)
assert card.tagged_with?(tags(:web))
post card_taggings_path(card), params: { tag_title: tags(:web).title }, as: :json
assert_response :no_content
assert_not card.reload.tagged_with?(tags(:web))
end
end