Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix time entry activity spec

Klaus Zanders0aa39c5c2d85
diff --git a/app/components/activities/item_component.rb b/app/components/activities/item_component.rb
index c62dd6bc571..803fead8871 100644
--- a/app/components/activities/item_component.rb
+++ b/app/components/activities/item_component.rb
@@ -141,15 +141,15 @@ class Activities::ItemComponent < ViewComponent::Base
return if !details.key?("entity_id") && !details.key?("entity_type")
details["entity_gid"] = [
- build_gid(*type_and_id_for("entity", index: 0)),
- build_gid(*type_and_id_for("entity", index: 1))
+ build_gid(*type_and_id_for(details, "entity", index: 0)),
+ build_gid(*type_and_id_for(details, "entity", index: 1))
]
details.delete("entity_id")
details.delete("entity_type")
end
- def type_and_id_for(field, index:)
+ def type_and_id_for(details, field, index:)
[
details["#{field}_type"]&.at(index) || @event.journal.journable.public_send("#{field}_type"),
details["#{field}_id"]&.at(index) || @event.journal.journable.public_send("#{field}_id")
diff --git a/spec/features/activities/time_entry_activity_spec.rb b/spec/features/activities/time_entry_activity_spec.rb
index 46df56f29b7..dc19ace48fd 100644
--- a/spec/features/activities/time_entry_activity_spec.rb
+++ b/spec/features/activities/time_entry_activity_spec.rb
@@ -105,7 +105,7 @@ RSpec.describe "TimeEntry activity",
within("li.op-activity-list--item", match: :first) do
expect(page).to have_link("#{project.types.first} ##{work_package2.id}: #{work_package2.subject}")
expect(page).to have_css("li", text: "Logged for #{user2.name}")
- expect(page).to have_css("li", text: "Work package changed from #{work_package.name} to #{work_package2.name}")
+ expect(page).to have_css("li", text: "Entity changed from #{work_package.name} to #{work_package2.name}")
expect(page).to have_css("li", text: "Spent time changed from 5 hours to 1 hour")
expect(page).to have_css("li", text: "Comment changed from #{old_comments} to #{time_entry.comments}")
expect(page).to have_css("li",