Use card rerendering instead of redirects
This commit is contained in:
@@ -13,12 +13,12 @@ class Cards::AssignmentsControllerTest < ActionDispatch::IntegrationTest
|
||||
test "create" do
|
||||
assert_changes "cards(:logo).assigned_to?(users(:david))", from: false, to: true do
|
||||
post card_assignments_path(cards(:logo)), params: { assignee_id: users(:david).id }, as: :turbo_stream
|
||||
assert_card_container_rerendered(cards(:logo))
|
||||
end
|
||||
assert_response :success
|
||||
|
||||
assert_changes "cards(:logo).assigned_to?(users(:david))", from: true, to: false do
|
||||
post card_assignments_path(cards(:logo)), params: { assignee_id: users(:david).id }, as: :turbo_stream
|
||||
assert_card_container_rerendered(cards(:logo))
|
||||
end
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,11 +10,10 @@ class Cards::ClosuresControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_changes -> { card.reload.closed? }, from: false, to: true do
|
||||
post card_closure_path(card, reason: "Scope too big")
|
||||
assert_card_container_rerendered(card)
|
||||
end
|
||||
|
||||
assert_equal "Scope too big", card.closure.reason
|
||||
|
||||
assert_redirected_to collection_card_path(card.collection, card)
|
||||
end
|
||||
|
||||
test "destroy" do
|
||||
@@ -22,8 +21,7 @@ class Cards::ClosuresControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_changes -> { card.reload.closed? }, from: true, to: false do
|
||||
delete card_closure_path(card)
|
||||
assert_card_container_rerendered(card)
|
||||
end
|
||||
|
||||
assert_redirected_to collection_card_path(card.collection, card)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,9 +10,8 @@ class Cards::EngagementsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_changes -> { card.reload.doing? }, from: false, to: true do
|
||||
post card_engagement_path(card)
|
||||
assert_card_container_rerendered(card)
|
||||
end
|
||||
|
||||
assert_redirected_to collection_card_path(card.collection, card)
|
||||
end
|
||||
|
||||
test "destroy" do
|
||||
@@ -20,8 +19,12 @@ class Cards::EngagementsControllerTest < ActionDispatch::IntegrationTest
|
||||
|
||||
assert_changes -> { card.reload.doing? }, from: true, to: false do
|
||||
delete card_engagement_path(card)
|
||||
assert_card_container_rerendered(card)
|
||||
end
|
||||
|
||||
assert_redirected_to collection_card_path(card.collection, card)
|
||||
end
|
||||
|
||||
private
|
||||
def assert_card_container_rerendered(card)
|
||||
assert_turbo_stream action: :replace, target: dom_id(card, :card_container)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,14 +8,14 @@ class Cards::GoldnessesControllerTest < ActionDispatch::IntegrationTest
|
||||
test "create" do
|
||||
assert_changes -> { cards(:text).reload.golden? }, from: false, to: true do
|
||||
post card_goldness_path(cards(:text)), as: :turbo_stream
|
||||
assert_response :success
|
||||
assert_card_container_rerendered(cards(:text))
|
||||
end
|
||||
end
|
||||
|
||||
test "destroy" do
|
||||
assert_changes -> { cards(:logo).reload.golden? }, from: true, to: false do
|
||||
delete card_goldness_path(cards(:logo)), as: :turbo_stream
|
||||
assert_response :success
|
||||
assert_card_container_rerendered(cards(:logo))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -13,14 +13,14 @@ class Cards::TaggingsControllerTest < ActionDispatch::IntegrationTest
|
||||
test "toggle tag on" do
|
||||
assert_changes "cards(:logo).tagged_with?(tags(:mobile))", from: false, to: true do
|
||||
post card_taggings_path(cards(:logo)), params: { tag_title: tags(:mobile).title }, as: :turbo_stream
|
||||
assert_card_container_rerendered(cards(:logo))
|
||||
end
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "toggle tag off" do
|
||||
assert_changes "cards(:logo).tagged_with?(tags(:web))", from: true, to: false do
|
||||
post card_taggings_path(cards(:logo)), params: { tag_title: tags(:web).title }, as: :turbo_stream
|
||||
assert_card_container_rerendered(cards(:logo))
|
||||
end
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user