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

WIP: Add specs

Mir Bhatiad802c2667afa
diff --git a/spec/components/activities/item_component_spec.rb b/spec/components/activities/item_component_spec.rb
index 79a12b19538..553866ed00f 100644
--- a/spec/components/activities/item_component_spec.rb
+++ b/spec/components/activities/item_component_spec.rb
@@ -122,18 +122,21 @@ RSpec.describe Activities::ItemComponent, type: :component do
end
end
- # context 'for TimeEntry activites' do
- # let(:journal) { build_stubbed(:time_entry_journal) }
-
- # it 'has the correct format when a TimeEntry is created' do
- # component = described_class.new(event:)
- # render_inline(component)
- # expect(component.project_suffix).to be_nil
- # expect(page).to have_css('.op-activity-list--item-title', text: /\A\s*Event Title\s*\z/)
- # end
-
- # # it 'has the correct format when a TimeEntry is updated' do
- # # end
-
- # end
+ context 'for TimeEntry activites' do
+ let(:event) do
+ Activities::Event.new(
+ event_title: "Event Title",
+ event_path: "/project/123",
+ project_id: project.id,
+ project:,
+ journal:
+ )
+ end
+ let(:journal) { build_stubbed(:time_entry_journal) }
+ it 'displays the title correctly' do
+ component = described_class.new(event:)
+ render_inline(component)
+ expect(page).to have_css('.op-activity-list--item-title', text: /Event Title\s+\(Project: My project\)/)
+ end
+ end
end
diff --git a/spec/components/activities/item_subtitle_component_spec.rb b/spec/components/activities/item_subtitle_component_spec.rb
index ed82a384c86..ac2429e63df 100644
--- a/spec/components/activities/item_subtitle_component_spec.rb
+++ b/spec/components/activities/item_subtitle_component_spec.rb
@@ -69,5 +69,21 @@ RSpec.describe Activities::ItemSubtitleComponent, type: :component do
it { is_expected.to have_text("updated on #{format_time(datetime)}") }
end
- # TODO - Add for TimeEntry
+ context 'on TimeEntry creation' do
+ let(:is_creation) { true }
+ let(:user) { build_stubbed(:user) }
+ let(:journable_type) { 'TimeEntry' }
+
+ it { is_expected.to have_text("time logged by #{user.name} on #{format_time(datetime)}") }
+ end
+
+ context 'on TimeEntry updation' do
+ let(:is_creation) { false }
+ let(:user) { build_stubbed(:user) }
+ let(:journable_type) { 'TimeEntry' }
+
+ it { is_expected.to have_text("time logged updated by #{user.name} on #{format_time(datetime)}") }
+ end
+
+ # space issues?
end