Permette di correggere la timeline e ripristina la ricerca in alto.
CI / scan_ruby (push) Failing after 11m33s
CI / scan_js (push) Successful in 11m14s
CI / lint (push) Failing after 11m48s

Le voci si possono modificare o eliminare se registrate per errore, e la ricerca non va più in errore SQL sul campo email.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-18 23:09:30 +02:00
co-authored by Cursor
parent 4e03fa58ab
commit 34114e8ca8
8 changed files with 162 additions and 6 deletions
@@ -0,0 +1,53 @@
require "test_helper"
class ActivitiesControllerTest < ActionDispatch::IntegrationTest
setup do
@org = organizations(:acme)
@activity = activities(:note)
login_as users(:admin)
end
test "organization show lets you edit and delete timeline entries" do
get organization_path(@org, project_code: "matchlivetv")
assert_response :success
assert_match edit_organization_activity_path(@org, @activity, project_code: "matchlivetv"), response.body
assert_match(/Elimina/, response.body)
end
test "can open edit form for a timeline activity" do
get edit_organization_activity_path(@org, @activity, project_code: "matchlivetv")
assert_response :success
assert_match(/Modifica attività/, response.body)
assert_match(/Prima nota/, response.body)
end
test "can update a timeline activity" do
patch organization_activity_path(@org, @activity, project_code: "matchlivetv"), params: {
activity: {
activity_type: "note",
subject: "Nota corretta",
description: "Testo aggiornato",
happened_at: Time.zone.parse("2026-08-18 21:00")
}
}
assert_redirected_to organization_path(@org, project_code: "matchlivetv")
@activity.reload
assert_equal "Nota corretta", @activity.subject
assert_equal "Testo aggiornato", @activity.description
end
test "can delete a timeline activity" do
assert_difference "Activity.count", -1 do
delete organization_activity_path(@org, @activity, project_code: "matchlivetv")
end
assert_redirected_to organization_path(@org, project_code: "matchlivetv")
end
test "rejects blank subject on update" do
patch organization_activity_path(@org, @activity, project_code: "matchlivetv"), params: {
activity: { subject: "", activity_type: "note", happened_at: Time.current }
}
assert_response :unprocessable_entity
assert_equal "Prima nota", @activity.reload.subject
end
end
@@ -0,0 +1,34 @@
require "test_helper"
class SearchControllerTest < ActionDispatch::IntegrationTest
test "header includes a search form with submit" do
login_as users(:admin)
get organizations_path(project_code: "matchlivetv")
assert_response :success
assert_includes response.body, 'action="/p/matchlivetv/search"'
assert_includes response.body, 'method="get"'
assert_includes response.body, 'name="q"'
assert_includes response.body, 'type="submit"'
end
test "search finds organization by name" do
login_as users(:admin)
get search_path(project_code: "matchlivetv", q: "ASD Test")
assert_response :success
assert_match(/ASD Test Calcio/, response.body)
end
test "search finds contact by last name" do
login_as users(:admin)
get search_path(project_code: "matchlivetv", q: "Rossi")
assert_response :success
assert_match(/Mario Rossi/, response.body)
end
test "empty search does not error" do
login_as users(:admin)
get search_path(project_code: "matchlivetv")
assert_response :success
assert_match(/Nessun risultato/, response.body)
end
end