Permette di correggere la timeline e ripristina la ricerca in alto.
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:
@@ -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
|
||||
Reference in New Issue
Block a user