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

Remove obsolete tests. As we don't show details any more, we don't need to test for it.

Henriette Darge5cc6ab0f4d83
diff --git a/app/views/digest_mailer/work_packages.html.erb b/app/views/digest_mailer/work_packages.html.erb
index 58790884b66..b8ae67e8aef 100644
--- a/app/views/digest_mailer/work_packages.html.erb
+++ b/app/views/digest_mailer/work_packages.html.erb
@@ -4,7 +4,7 @@
</tr>
</table>
-<table <%= placeholder_table_styles(width:'100%',style: 'width:100%;max-width:700px;margin-left:auto;margin-right:auto') %>>
+<table <%= placeholder_table_styles(width:'100%',style: 'width:100%;max-width:700px;') %>>
<tr>
<%= placeholder_cell('12px', vertical: true) %>
<td>
diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb
index 37c8ceafda6..76c278668b6 100644
--- a/app/views/layouts/mailer.html.erb
+++ b/app/views/layouts/mailer.html.erb
@@ -77,13 +77,18 @@ See COPYRIGHT and LICENSE files for more details.
.footer {
font-size: 0.8em;
font-style: italic;
- max-width: 700px;
- margin-left: auto;
- margin-right: auto;
border-top-width: 1px;
border-top-color: #ccc;
border-top-style: solid;
}
+ .header,
+ .body,
+ .footer {
+ max-width: 700px;
+ width: 100%;
+ margin-left: auto;
+ margin-right: auto;
+ }
a.user-mention:before {
content: '@';
color: #878787;
@@ -102,7 +107,13 @@ See COPYRIGHT and LICENSE files for more details.
</tr>
</table>
<%= call_hook(:view_layouts_mailer_html_before_content, self.assigns) %>
- <%= yield %>
+ <table class="body">
+ <tr>
+ <td>
+ <%= yield %>
+ </td>
+ </tr>
+ </table>
<%= call_hook(:view_layouts_mailer_html_after_content, self.assigns) %>
<table class="footer">
<tr>
diff --git a/app/views/work_package_mailer/mentioned.html.erb b/app/views/work_package_mailer/mentioned.html.erb
index 737853edef9..a0a7930eda9 100644
--- a/app/views/work_package_mailer/mentioned.html.erb
+++ b/app/views/work_package_mailer/mentioned.html.erb
@@ -4,7 +4,7 @@
</tr>
</table>
-<table <%= placeholder_table_styles(width:'100%',style: 'width:100%;max-width:700px;margin-left:auto;margin-right:auto') %>>
+<table <%= placeholder_table_styles(width:'100%',style: 'width:100%;max-width:700px;') %>>
<tr>
<%= placeholder_cell('12px', vertical: true) %>
<td>
diff --git a/spec/mailers/digest_mailer_spec.rb b/spec/mailers/digest_mailer_spec.rb
index 6b7ff1b3675..8baf8c05641 100644
--- a/spec/mailers/digest_mailer_spec.rb
+++ b/spec/mailers/digest_mailer_spec.rb
@@ -104,7 +104,7 @@ describe DigestMailer, type: :mailer do
end
it 'includes the notifications grouped by work package' do
- time_stamp = journal.created_at.strftime('%I:%M %p')
+ time_stamp = journal.created_at.strftime('%m/%d/%Y, %I:%M %p')
expect(mail_body)
.to have_text("Hey #{recipient.firstname}!")
@@ -116,13 +116,9 @@ describe DigestMailer, type: :mailer do
expect(mail_body)
.to have_text(expected_notification_header, normalize_ws: true)
- expected_journal_text = "Comment added at #{time_stamp} by #{recipient.name}"
+ expected_text = "#{journal.initial? ? 'Created' : 'Updated'} at #{time_stamp} by #{recipient.name}"
expect(mail_body)
- .to have_text(expected_journal_text, normalize_ws: true)
-
- expected_details_text = "Subject changed from old subject to new subject at #{time_stamp} by #{recipient.name}"
- expect(mail_body)
- .to have_text(expected_details_text, normalize_ws: true)
+ .to have_text(expected_text, normalize_ws: true)
end
context 'with only a deleted work package for the digest' do
@@ -136,347 +132,5 @@ describe DigestMailer, type: :mailer do
.to eql({})
end
end
-
- describe 'journal details in plain mail', with_settings: { plain_text_mail: '1' } do
- subject(:mail) { described_class.work_packages(recipient.id, notifications.map(&:id)).body.encoded.gsub("\r\n", "\n") }
-
- context 'with changed done ratio' do
- before do
- allow(journal).to receive(:details).and_return('done_ratio' => [40, 100])
- end
-
- it 'displays changed done ratio' do
- expect(subject).to include("Progress (%) changed from 40 to 100")
- end
- end
-
- context 'with new done ratio' do
- before do
- allow(journal).to receive(:details).and_return('done_ratio' => [nil, 100])
- end
-
- it 'displays new done ratio' do
- expect(subject).to include("Progress (%) changed from 0 to 100")
- end
- end
-
- context 'with deleted done ratio' do
- before do
- allow(journal).to receive(:details).and_return('done_ratio' => [50, nil])
- end
-
- it 'displays deleted done ratio' do
- expect(subject).to include("Progress (%) changed from 50 to 0")
- end
- end
-
- describe 'start_date attribute' do
- before do
- allow(journal).to receive(:details).and_return('start_date' => %w[2010-01-01 2010-01-31])
- end
-
- it 'old date should be formatted' do
- expect(subject).to match('01/01/2010')
- end
-
- it 'new date should be formatted' do
- expect(subject).to match('01/31/2010')
- end
- end
-
- describe 'due_date attribute' do
- before do
- allow(journal).to receive(:details).and_return('due_date' => %w[2010-01-01 2010-01-31])
- end
-
- it 'old date should be formatted' do
- expect(subject).to match('01/01/2010')
- end
-
- it 'new date should be formatted' do
- expect(subject).to match('01/31/2010')
- end
- end
-
- describe 'project attribute' do
- let(:project1) { FactoryBot.create(:project) }
- let(:project2) { FactoryBot.create(:project) }
-
- before do
- allow(journal).to receive(:details).and_return('project_id' => [project1.id, project2.id])
- end
-
- it "shows the old project's name" do
- expect(subject).to match(project1.name)
- end
-
- it "shows the new project's name" do
- expect(subject).to match(project2.name)
- end
- end
-
- describe 'attribute issue status' do
- let(:status1) { FactoryBot.create(:status) }
- let(:status2) { FactoryBot.create(:status) }
-
- before do
- allow(journal).to receive(:details).and_return('status_id' => [status1.id, status2.id])
- end
-
- it "shows the old status' name" do
- expect(subject).to match(status1.name)
- end
-
- it "shows the new status' name" do
- expect(subject).to match(status2.name)
- end
- end
-
- describe 'attribute type' do
- let(:type1) { FactoryBot.create(:type_standard) }
- let(:type2) { FactoryBot.create(:type_bug) }
-
- before do
- allow(journal).to receive(:details).and_return('type_id' => [type1.id, type2.id])
- end
-
- it "shows the old type's name" do
- expect(subject).to match(type1.name)
- end
-
- it "shows the new type's name" do
- expect(subject).to match(type2.name)
- end
- end
-
- describe 'attribute assigned to' do
- let(:assignee1) { FactoryBot.create(:user) }
- let(:assignee2) { FactoryBot.create(:user) }
-
- before do
- allow(journal).to receive(:details).and_return('assigned_to_id' => [assignee1.id, assignee2.id])
- end
-
- it "shows the old assignee's name" do
- expect(subject).to match(assignee1.name)
- end
-
- it "shows the new assignee's name" do
- expect(subject).to match(assignee2.name)
- end
- end
-
- describe 'attribute priority' do
- let(:priority1) { FactoryBot.create(:priority) }
- let(:priority2) { FactoryBot.create(:priority) }
-
- before do
- allow(journal).to receive(:details).and_return('priority_id' => [priority1.id, priority2.id])
- end
-
- it "shows the old priority's name" do
- expect(subject).to match(priority1.name)
- end
-
- it "shows the new priority's name" do
- expect(subject).to match(priority2.name)
- end
- end
-
- describe 'attribute category' do
- let(:category1) { FactoryBot.create(:category) }
- let(:category2) { FactoryBot.create(:category) }
-
- before do
- allow(journal).to receive(:details).and_return('category_id' => [category1.id, category2.id])
- end
-
- it "shows the old category's name" do
- expect(subject).to match(category1.name)
- end
-
- it "shows the new category's name" do
- expect(subject).to match(category2.name)
- end
- end
-
- describe 'attribute version' do
- let(:version1) { FactoryBot.create(:version) }
- let(:version2) { FactoryBot.create(:version) }
-
- before do
- allow(journal).to receive(:details).and_return('version_id' => [version1.id, version2.id])
- end
-
- it "shows the old version's name" do
- expect(subject).to match(version1.name)
- end
-
- it "shows the new version's name" do
- expect(subject).to match(version2.name)
- end
- end
-
- describe 'attribute estimated hours' do
- let(:estimated_hours1) { 30.5678 }
- let(:estimated_hours2) { 35.912834 }
-
- before do
- allow(journal).to receive(:details).and_return('estimated_hours' => [estimated_hours1, estimated_hours2])
- end
-
- it 'shows the old estimated hours' do
- expect(subject).to match('%.2f' % estimated_hours1)
- end
-
- it 'shows the new estimated hours' do
- expect(subject).to match('%.2f' % estimated_hours2)
- end
- end
-
- describe 'custom field' do
- let(:expected_text) { 'original, unchanged text' }
- let(:expected_text2) { 'modified, new text' }
- let(:custom_field) do
- FactoryBot.create :work_package_custom_field,
- field_format: 'text'
- end
-
- before do
- allow(journal).to receive(:details).and_return("custom_fields_#{custom_field.id}" => [expected_text, expected_text2])
- end
-
- it 'shows the old custom field value' do
- expect(subject).to match(expected_text)
- end
-
- it 'shows the new custom field value' do
- expect(subject).to match(expected_text2)
- end
- end
- end
-
- describe 'journal details in html mail' do
- subject(:mail) do
- described_class.work_packages(recipient.id, notifications.map(&:id)).body.parts[1].body.to_s.gsub("\r\n", "\n")
- end
-
- let(:expected_translation) do
- I18n.t(:done_ratio, scope: %i[activerecord
- attributes
- work_package])
- end
- let(:expected_prefix) { "<strong>#{expected_translation}</strong>" }
-
- context 'with changed done ratio' do
- let(:expected) do
- "#{expected_prefix} changed from <i title=\"40\">40</i> <strong>to</strong> <i title=\"100\">100</i>"
- end
-
- before do
- allow(journal).to receive(:details).and_return('done_ratio' => [40, 100])
- end
-
- it 'displays changed done ratio' do
- expect(subject).to include(expected)
- end
- end
-
- context 'with changed subject to long value' do
- let(:old_subject) { 'foo' }
- let(:new_subject) { 'abcd' * 25 }
- let(:expected) do
- "<strong>Subject</strong> changed from <i title=\"#{old_subject}\">#{old_subject}</i> <br/><strong>to</strong> " \
- "<i title=\"#{new_subject}\">#{new_subject}</i>"
- end
-
- before do
- allow(journal).to receive(:details).and_return('subject' => [old_subject, new_subject])
- end
-
- it 'displays changed subject with newline' do
- expect(subject).to include(expected)
- end
- end
-
- context 'with new done ratio' do
- let(:expected) do
- "#{expected_prefix} changed from <i title=\"0\">0</i> <strong>to</strong> <i title=\"100\">100</i>"
- end
-
- before do
- allow(journal).to receive(:details).and_return('done_ratio' => [nil, 100])
- end
-
- it 'displays new done ratio' do
- expect(subject).to include(expected)
- end
- end
-
- context 'with deleted done ratio' do
- let(:expected) { "#{expected_prefix} changed from <i title=\"50\">50</i> <strong>to</strong> <i title=\"0\">0</i>" }
-
- before do
- allow(journal).to receive(:details).and_return('done_ratio' => [50, nil])
- end
-
- it 'displays deleted done ratio' do
- expect(subject).to include(expected)
- end
- end
-
- describe 'attachments', with_settings: { host_name: "mydomain.foo" } do
- shared_let(:attachment) { FactoryBot.create(:attachment) }
- let(:journal) do
- FactoryBot.build_stubbed(:work_package_journal)
- end
-
- context 'when added' do # rubocop:disable Rspec/NestedGroups
- before do
- allow(journal).to receive(:details).and_return("attachments_#{attachment.id}" => [nil, attachment.filename])
- end
-
- it "shows the attachment's filename" do
- expect(subject).to include(attachment.filename)
- end
-
- it "links correctly" do
- expect(subject).to include("<a href=\"http://mydomain.foo/api/v3/attachments/#{attachment.id}/content\">")
- end
-
- context 'with a suburl', with_config: { rails_relative_url_root: '/rdm' } do # rubocop:disable Rspec/NestedGroups
- it "links correctly" do
- expect(subject).to include("<a href=\"http://mydomain.foo/rdm/api/v3/attachments/#{attachment.id}/content\">")
- end
- end
-
- it "shows status 'added'" do
- expect(subject).to include('added')
- end
-
- it "shows no status 'deleted'" do
- expect(subject).not_to include('deleted')
- end
- end
-
- context 'when removed' do # rubocop:disable Rspec/NestedGroups
- before do
- allow(journal).to receive(:details).and_return("attachments_#{attachment.id}" => [attachment.filename, nil])
- end
-
- it "shows the attachment's filename" do
- expect(subject).to include(attachment.filename)
- end
-
- it "shows no status 'added'" do
- expect(subject).not_to include('added')
- end
-
- it "shows status 'deleted'" do
- expect(subject).to include('deleted')
- end
- end
- end
- end
end
end
diff --git a/spec/mailers/member_mailer_spec.rb b/spec/mailers/member_mailer_spec.rb
index 8982f5cc9de..74ef1bcfe61 100644
--- a/spec/mailers/member_mailer_spec.rb
+++ b/spec/mailers/member_mailer_spec.rb
@@ -107,7 +107,7 @@ describe MemberMailer, type: :mailer do
expect(body)
.to be_html_eql(expected)
- .at_path('body/ul')
+ .at_path('body/table/tr/td/ul')
end
context 'with a custom message' do