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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#62107] Fix specs. Add openjdk to backend image.
Pavel Balashoue78b12a51e9e
diff --git a/app/views/digest_mailer/work_packages.text.erb b/app/views/digest_mailer/work_packages.text.erbindex 60e91feda0f..5c2983d8d13 100644--- a/app/views/digest_mailer/work_packages.text.erb+++ b/app/views/digest_mailer/work_packages.text.erb@@ -2,7 +2,7 @@<%= "#{I18n.t(:"mail.digests.you_have")} #{digest_summary_text(@notification_ids.length, @mentioned_count)}" %><%= "-" * 100 %>-<% @aggregated_notifications.first(DigestMailer::MAX_SHOWN_WORK_PACKAGES).each do | work_package, notifications_by_work_package| %>+<% @aggregated_notifications.first(DigestMailer::MAX_SHOWN_WORK_PACKAGES).each do |work_package, notifications_by_work_package| %><%= "=" * (("# " + work_package.id.to_s + work_package.subject).length + 4) %>= #<%= work_package.id %> <%= work_package.subject %> =diff --git a/docker/dev/backend/Dockerfile b/docker/dev/backend/Dockerfileindex 4ca47880570..693eab9fffa 100644--- a/docker/dev/backend/Dockerfile+++ b/docker/dev/backend/Dockerfile@@ -37,6 +37,9 @@ RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesourcRUN apt-get updateRUN apt-get install -y nodejs+# Setup java. Needed for https://github.com/NUARIG/ladle which is used in specs to test LDAP related behavior.+RUN apt-get install -y openjdk-17-jdk+COPY ./docker/dev/backend/scripts/setup /usr/sbin/setupCOPY ./docker/dev/backend/scripts/setup-bim /usr/sbin/setup-bimCOPY ./docker/dev/backend/scripts/run-app /usr/sbin/run-appdiff --git a/spec/components/work_packages/activities_tab/journals/item_component/reactions_spec.rb b/spec/components/work_packages/activities_tab/journals/item_component/reactions_spec.rbindex 561731d5837..9c8533b7949 100644--- a/spec/components/work_packages/activities_tab/journals/item_component/reactions_spec.rb+++ b/spec/components/work_packages/activities_tab/journals/item_component/reactions_spec.rb@@ -79,7 +79,7 @@ RSpec.describe WorkPackages::ActivitiesTab::Journals::ItemComponent::Reactions,enddef mock_detailed_grouped_emoji_reactions- users = build_stubbed_list(:user, 20).map { |user| { id: user.id, name: user.name } }+ users = build_stubbed_list(:user, 20, lastname: "Bobbit").map { |user| { id: user.id, name: user.name } }{thumbs_up: { users: users.sample(3), count: 3 },diff --git a/spec/mailers/digest_mailer_spec.rb b/spec/mailers/digest_mailer_spec.rbindex aa940eb893f..72c84fd51e8 100644--- a/spec/mailers/digest_mailer_spec.rb+++ b/spec/mailers/digest_mailer_spec.rb@@ -36,43 +36,27 @@ RSpec.describe DigestMailer doinclude OpenProject::StaticRouting::UrlHelpersinclude Redmine::I18n- let(:recipient) do- build_stubbed(:user).tap do |u|- allow(User)- .to receive(:find)- .with(u.id)- .and_return(u)- end- end- let(:project1) { build_stubbed(:project) }-+ let!(:project1) { create(:project) }+ let!(:recipient) { create(:user) }let(:work_package) do- build_stubbed(:work_package,- type: build_stubbed(:type))+ create(:work_package,+ subject: "WP start past",+ project: project1,+ start_date: 1.day.ago,+ type: Type.first,+ author: recipient)endlet(:journal) do- build_stubbed(:work_package_journal,- notes: "Some notes").tap do |j|- allow(j)- .to receive(:details)- .and_return({ "subject" => ["old subject", "new subject"] })+ work_package.journals.first.tap do |j|+ j.update(user_id: recipient.id)endend- let(:notifications) do- [build_stubbed(:notification,- resource: work_package,- reason: :commented,- journal:)].tap do |notifications|- allow(Notification)- .to receive(:where)- .and_return(notifications)-- without_partial_double_verification do- allow(notifications)- .to receive(:includes)- .and_return(notifications)- end- end+ let!(:notifications) do+ [create(:notification,+ resource: work_package,+ recipient:,+ reason: :commented,+ journal:)]enddescribe "#work_packages" do@@ -81,66 +65,50 @@ RSpec.describe DigestMailer dolet(:mail_body) { mail.body.parts.detect { |part| part["Content-Type"].value == "text/html" }.body.to_s }it "notes the day and the number of notifications in the subject" do- expect(mail.subject)- .to eql "OpenProject - 1 unread notification"+ expect(mail.subject).to eql "OpenProject - 1 unread notification"endit "sends to the recipient" do- expect(mail.to)- .to contain_exactly(recipient.mail)+ expect(mail.to).to contain_exactly(recipient.mail)endit "sets the expected message_id header" do- allow(Time)- .to receive(:current)- .and_return(Time.current)+ allow(Time).to receive(:current).and_return(Time.current)- expect(mail.message_id)- .to eql "op.digest.#{Time.current.strftime('%Y%m%d%H%M%S')}.#{recipient.id}@example.net"+ expect(mail.message_id).to eql "op.digest.#{Time.current.strftime('%Y%m%d%H%M%S')}.#{recipient.id}@example.net"endit "sets the expected openproject headers" do- expect(mail["X-OpenProject-User"]&.value)- .to eql recipient.name+ expect(mail["X-OpenProject-User"]&.value).to eql recipient.nameendit "includes the notifications grouped by work package" dotime_stamp = format_time(journal.created_at)- expect(mail_body)- .to have_text("Hello #{recipient.firstname}")+ expect(mail_body).to have_text("Hello #{recipient.firstname}")expected_notification_subject = "#{work_package.type.name.upcase} #{work_package.subject}"- expect(mail_body)- .to have_text(expected_notification_subject, normalize_ws: true)+ expect(mail_body).to have_text(expected_notification_subject, normalize_ws: true)expected_notification_header = "#{work_package.status.name} ##{work_package.id} - #{work_package.project}"- expect(mail_body)- .to have_text(expected_notification_header, normalize_ws: true)+ expect(mail_body).to have_text(expected_notification_header, normalize_ws: true)expected_text = "#{journal.initial? ? 'Created' : 'Updated'} at #{time_stamp} by #{recipient.name}"- expect(mail_body)- .to have_text(expected_text, normalize_ws: true)+ expect(mail_body).to have_text(expected_text, normalize_ws: true)endit "includes a reference to the notification center if there are more than the maximum number of shown work packages" dostub_const("DigestMailer::MAX_SHOWN_WORK_PACKAGES", 0)- expect(mail_body)- .to have_text I18n.t(:"mail.work_packages.more_to_see.one")-- expect(mail_body)- .to have_link(I18n.t(:"mail.work_packages.see_all"), href: notifications_url)+ expect(mail_body).to have_text I18n.t(:"mail.work_packages.more_to_see.one")+ expect(mail_body).to have_link(I18n.t(:"mail.work_packages.see_all"), href: notifications_url)endcontext "with only a deleted work package for the digest" do- let(:work_package) { nil }+ before { work_package.destroy }it "is a NullMail which isn't sent" do- expect(mail.body)- .to eql ""-- expect(mail.header)- .to eql({})+ expect(mail.body).to eql ""+ expect(mail.header).to eql({})endenddiff --git a/spec/requests/api/v3/user/user_resource_spec.rb b/spec/requests/api/v3/user/user_resource_spec.rbindex a4a08e376c0..9120306663d 100644--- a/spec/requests/api/v3/user/user_resource_spec.rb+++ b/spec/requests/api/v3/user/user_resource_spec.rb@@ -36,8 +36,8 @@ RSpec.describe "API v3 User resource",include Rack::Test::Methodsinclude API::V3::Utilities::PathHelper- let(:current_user) { create(:user) }- let(:user) { create(:user) }+ let(:current_user) { user }+ let(:user) { create(:user, lastname: "Bobbit") }let(:admin) { create(:admin) }let(:locked_admin) { create(:admin, status: Principal.statuses[:locked]) }let(:user_with_global_manage_user) dodiff --git a/spec/services/ldap/import_user_list_service_integration_spec.rb b/spec/services/ldap/import_user_list_service_integration_spec.rbindex 70d5608e47c..ac423e604a2 100644--- a/spec/services/ldap/import_user_list_service_integration_spec.rb+++ b/spec/services/ldap/import_user_list_service_integration_spec.rb@@ -33,8 +33,8 @@ RSpec.describe Ldap::ImportUsersFromListService doendcontext "when two users already exist" do- let!(:user_aa729) { create(:user, login: "aa729", firstname: "Foobar", ldap_auth_source:) }- let!(:user_bb459) { create(:user, login: "bb459", firstname: "Bla", ldap_auth_source:) }+ let!(:user_aa729) { create(:user, login: "aa729", firstname: "Foobar", lastname: "Bobbit", ldap_auth_source:) }+ let!(:user_bb459) { create(:user, login: "bb459", firstname: "Bla", lastname: "Bobbit", ldap_auth_source:) }it "adds the third one, but does not update the other two" dosubjectdiff --git a/spec/services/ldap/synchronize_users_service_integration_spec.rb b/spec/services/ldap/synchronize_users_service_integration_spec.rbindex 390a5bda6ab..c9db4e90934 100644--- a/spec/services/ldap/synchronize_users_service_integration_spec.rb+++ b/spec/services/ldap/synchronize_users_service_integration_spec.rb@@ -22,8 +22,8 @@ RSpec.describe Ldap::SynchronizeUsersService doendcontext "when updating users" do- let!(:user_aa729) { create(:user, login: "aa729", firstname: "Foobar", ldap_auth_source:) }- let!(:user_bb459) { create(:user, login: "bb459", firstname: "Bla", ldap_auth_source:) }+ let!(:user_aa729) { create(:user, login: "aa729", firstname: "Foobar", lastname: "Bobbit", ldap_auth_source:) }+ let!(:user_bb459) { create(:user, login: "bb459", firstname: "Bla", lastname: "Bobbit", ldap_auth_source:) }context "when user sync status is enabled",with_config: { ldap_users_sync_status: true } do