Commit e30168dd authored by Robert Speicher's avatar Robert Speicher

Merge branch '46845-update-email_spec-to-2-2-0' into 'master'

Update email_spec to 2.2.0

Closes #46845

See merge request gitlab-org/gitlab-ce!19164
parents 35ba75f6 d46c1229
...@@ -374,7 +374,7 @@ end ...@@ -374,7 +374,7 @@ end
group :test do group :test do
gem 'shoulda-matchers', '~> 3.1.2', require: false gem 'shoulda-matchers', '~> 3.1.2', require: false
gem 'email_spec', '~> 1.6.0' gem 'email_spec', '~> 2.2.0'
gem 'json-schema', '~> 2.8.0' gem 'json-schema', '~> 2.8.0'
gem 'webmock', '~> 2.3.2' gem 'webmock', '~> 2.3.2'
gem 'rails-controller-testing' if rails5? # Rails5 only gem. gem 'rails-controller-testing' if rails5? # Rails5 only gem.
......
...@@ -178,9 +178,10 @@ GEM ...@@ -178,9 +178,10 @@ GEM
dropzonejs-rails (0.7.2) dropzonejs-rails (0.7.2)
rails (> 3.1) rails (> 3.1)
email_reply_trimmer (0.1.6) email_reply_trimmer (0.1.6)
email_spec (1.6.0) email_spec (2.2.0)
htmlentities (~> 4.3.3)
launchy (~> 2.1) launchy (~> 2.1)
mail (~> 2.2) mail (~> 2.7)
encryptor (3.0.0) encryptor (3.0.0)
equalizer (0.0.11) equalizer (0.0.11)
erubis (2.7.0) erubis (2.7.0)
...@@ -1012,7 +1013,7 @@ DEPENDENCIES ...@@ -1012,7 +1013,7 @@ DEPENDENCIES
doorkeeper-openid_connect (~> 1.3) doorkeeper-openid_connect (~> 1.3)
dropzonejs-rails (~> 0.7.1) dropzonejs-rails (~> 0.7.1)
email_reply_trimmer (~> 0.1) email_reply_trimmer (~> 0.1)
email_spec (~> 1.6.0) email_spec (~> 2.2.0)
factory_bot_rails (~> 4.8.2) factory_bot_rails (~> 4.8.2)
faraday (~> 0.12) faraday (~> 0.12)
fast_blank fast_blank
......
---
title: Update email_spec to 2.2.0
merge_request: 19164
author: Takuya Noguchi
type: other
...@@ -68,7 +68,7 @@ describe Notify do ...@@ -68,7 +68,7 @@ describe Notify do
end end
it 'contains the description' do it 'contains the description' do
is_expected.to have_html_escaped_body_text issue.description is_expected.to have_body_text issue.description
end end
it 'does not add a reason header' do it 'does not add a reason header' do
...@@ -89,7 +89,7 @@ describe Notify do ...@@ -89,7 +89,7 @@ describe Notify do
end end
it 'contains a link to note author' do it 'contains a link to note author' do
is_expected.to have_html_escaped_body_text(issue.author_name) is_expected.to have_body_text(issue.author_name)
is_expected.to have_body_text 'created an issue:' is_expected.to have_body_text 'created an issue:'
end end
end end
...@@ -115,8 +115,8 @@ describe Notify do ...@@ -115,8 +115,8 @@ describe Notify do
it 'has the correct subject and body' do it 'has the correct subject and body' do
aggregate_failures do aggregate_failures do
is_expected.to have_referable_subject(issue, reply: true) is_expected.to have_referable_subject(issue, reply: true)
is_expected.to have_html_escaped_body_text(previous_assignee.name) is_expected.to have_body_text(previous_assignee.name)
is_expected.to have_html_escaped_body_text(assignee.name) is_expected.to have_body_text(assignee.name)
is_expected.to have_body_text(project_issue_path(project, issue)) is_expected.to have_body_text(project_issue_path(project, issue))
end end
end end
...@@ -190,7 +190,7 @@ describe Notify do ...@@ -190,7 +190,7 @@ describe Notify do
aggregate_failures do aggregate_failures do
is_expected.to have_referable_subject(issue, reply: true) is_expected.to have_referable_subject(issue, reply: true)
is_expected.to have_body_text(status) is_expected.to have_body_text(status)
is_expected.to have_html_escaped_body_text(current_user.name) is_expected.to have_body_text(current_user.name)
is_expected.to have_body_text(project_issue_path project, issue) is_expected.to have_body_text(project_issue_path project, issue)
end end
end end
...@@ -243,7 +243,7 @@ describe Notify do ...@@ -243,7 +243,7 @@ describe Notify do
end end
it 'contains the description' do it 'contains the description' do
is_expected.to have_html_escaped_body_text merge_request.description is_expected.to have_body_text merge_request.description
end end
context 'when sent with a reason' do context 'when sent with a reason' do
...@@ -260,7 +260,7 @@ describe Notify do ...@@ -260,7 +260,7 @@ describe Notify do
end end
it 'contains a link to note author' do it 'contains a link to note author' do
is_expected.to have_html_escaped_body_text merge_request.author_name is_expected.to have_body_text merge_request.author_name
is_expected.to have_body_text 'created a merge request:' is_expected.to have_body_text 'created a merge request:'
end end
end end
...@@ -286,9 +286,9 @@ describe Notify do ...@@ -286,9 +286,9 @@ describe Notify do
it 'has the correct subject and body' do it 'has the correct subject and body' do
aggregate_failures do aggregate_failures do
is_expected.to have_referable_subject(merge_request, reply: true) is_expected.to have_referable_subject(merge_request, reply: true)
is_expected.to have_html_escaped_body_text(previous_assignee.name) is_expected.to have_body_text(previous_assignee.name)
is_expected.to have_body_text(project_merge_request_path(project, merge_request)) is_expected.to have_body_text(project_merge_request_path(project, merge_request))
is_expected.to have_html_escaped_body_text(assignee.name) is_expected.to have_body_text(assignee.name)
end end
end end
...@@ -358,7 +358,7 @@ describe Notify do ...@@ -358,7 +358,7 @@ describe Notify do
aggregate_failures do aggregate_failures do
is_expected.to have_referable_subject(merge_request, reply: true) is_expected.to have_referable_subject(merge_request, reply: true)
is_expected.to have_body_text(status) is_expected.to have_body_text(status)
is_expected.to have_html_escaped_body_text(current_user.name) is_expected.to have_body_text(current_user.name)
is_expected.to have_body_text(project_merge_request_path(project, merge_request)) is_expected.to have_body_text(project_merge_request_path(project, merge_request))
end end
end end
...@@ -526,7 +526,7 @@ describe Notify do ...@@ -526,7 +526,7 @@ describe Notify do
it 'has the correct subject and body' do it 'has the correct subject and body' do
is_expected.to have_referable_subject(project_snippet, reply: true) is_expected.to have_referable_subject(project_snippet, reply: true)
is_expected.to have_html_escaped_body_text project_snippet_note.note is_expected.to have_body_text project_snippet_note.note
end end
end end
...@@ -539,7 +539,7 @@ describe Notify do ...@@ -539,7 +539,7 @@ describe Notify do
it 'has the correct subject and body' do it 'has the correct subject and body' do
is_expected.to have_subject("#{project.name} | Project was moved") is_expected.to have_subject("#{project.name} | Project was moved")
is_expected.to have_html_escaped_body_text project.full_name is_expected.to have_body_text project.full_name
is_expected.to have_body_text(project.ssh_url_to_repo) is_expected.to have_body_text(project.ssh_url_to_repo)
end end
end end
...@@ -566,7 +566,7 @@ describe Notify do ...@@ -566,7 +566,7 @@ describe Notify do
expect(to_emails).to eq([recipient.notification_email]) expect(to_emails).to eq([recipient.notification_email])
is_expected.to have_subject "Request to join the #{project.full_name} project" is_expected.to have_subject "Request to join the #{project.full_name} project"
is_expected.to have_html_escaped_body_text project.full_name is_expected.to have_body_text project.full_name
is_expected.to have_body_text project_project_members_url(project) is_expected.to have_body_text project_project_members_url(project)
is_expected.to have_body_text project_member.human_access is_expected.to have_body_text project_member.human_access
end end
...@@ -586,7 +586,7 @@ describe Notify do ...@@ -586,7 +586,7 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject "Access to the #{project.full_name} project was denied" is_expected.to have_subject "Access to the #{project.full_name} project was denied"
is_expected.to have_html_escaped_body_text project.full_name is_expected.to have_body_text project.full_name
is_expected.to have_body_text project.web_url is_expected.to have_body_text project.web_url
end end
end end
...@@ -603,7 +603,7 @@ describe Notify do ...@@ -603,7 +603,7 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject "Access to the #{project.full_name} project was granted" is_expected.to have_subject "Access to the #{project.full_name} project was granted"
is_expected.to have_html_escaped_body_text project.full_name is_expected.to have_body_text project.full_name
is_expected.to have_body_text project.web_url is_expected.to have_body_text project.web_url
is_expected.to have_body_text project_member.human_access is_expected.to have_body_text project_member.human_access
end end
...@@ -633,7 +633,7 @@ describe Notify do ...@@ -633,7 +633,7 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject "Invitation to join the #{project.full_name} project" is_expected.to have_subject "Invitation to join the #{project.full_name} project"
is_expected.to have_html_escaped_body_text project.full_name is_expected.to have_body_text project.full_name
is_expected.to have_body_text project.full_name is_expected.to have_body_text project.full_name
is_expected.to have_body_text project_member.human_access is_expected.to have_body_text project_member.human_access
is_expected.to have_body_text project_member.invite_token is_expected.to have_body_text project_member.invite_token
...@@ -657,10 +657,10 @@ describe Notify do ...@@ -657,10 +657,10 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject 'Invitation accepted' is_expected.to have_subject 'Invitation accepted'
is_expected.to have_html_escaped_body_text project.full_name is_expected.to have_body_text project.full_name
is_expected.to have_body_text project.web_url is_expected.to have_body_text project.web_url
is_expected.to have_body_text project_member.invite_email is_expected.to have_body_text project_member.invite_email
is_expected.to have_html_escaped_body_text invited_user.name is_expected.to have_body_text invited_user.name
end end
end end
...@@ -680,7 +680,7 @@ describe Notify do ...@@ -680,7 +680,7 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject 'Invitation declined' is_expected.to have_subject 'Invitation declined'
is_expected.to have_html_escaped_body_text project.full_name is_expected.to have_body_text project.full_name
is_expected.to have_body_text project.web_url is_expected.to have_body_text project.web_url
is_expected.to have_body_text project_member.invite_email is_expected.to have_body_text project_member.invite_email
end end
...@@ -932,7 +932,7 @@ describe Notify do ...@@ -932,7 +932,7 @@ describe Notify do
end end
it 'contains the message from the note' do it 'contains the message from the note' do
is_expected.to have_html_escaped_body_text note.note is_expected.to have_body_text note.note
end end
it 'contains an introduction' do it 'contains an introduction' do
...@@ -991,7 +991,7 @@ describe Notify do ...@@ -991,7 +991,7 @@ describe Notify do
expect(to_emails).to eq([recipient.notification_email]) expect(to_emails).to eq([recipient.notification_email])
is_expected.to have_subject "Request to join the #{group.name} group" is_expected.to have_subject "Request to join the #{group.name} group"
is_expected.to have_html_escaped_body_text group.name is_expected.to have_body_text group.name
is_expected.to have_body_text group_group_members_url(group) is_expected.to have_body_text group_group_members_url(group)
is_expected.to have_body_text group_member.human_access is_expected.to have_body_text group_member.human_access
end end
...@@ -1010,7 +1010,7 @@ describe Notify do ...@@ -1010,7 +1010,7 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject "Access to the #{group.name} group was denied" is_expected.to have_subject "Access to the #{group.name} group was denied"
is_expected.to have_html_escaped_body_text group.name is_expected.to have_body_text group.name
is_expected.to have_body_text group.web_url is_expected.to have_body_text group.web_url
end end
end end
...@@ -1026,7 +1026,7 @@ describe Notify do ...@@ -1026,7 +1026,7 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject "Access to the #{group.name} group was granted" is_expected.to have_subject "Access to the #{group.name} group was granted"
is_expected.to have_html_escaped_body_text group.name is_expected.to have_body_text group.name
is_expected.to have_body_text group.web_url is_expected.to have_body_text group.web_url
is_expected.to have_body_text group_member.human_access is_expected.to have_body_text group_member.human_access
end end
...@@ -1056,7 +1056,7 @@ describe Notify do ...@@ -1056,7 +1056,7 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject "Invitation to join the #{group.name} group" is_expected.to have_subject "Invitation to join the #{group.name} group"
is_expected.to have_html_escaped_body_text group.name is_expected.to have_body_text group.name
is_expected.to have_body_text group.web_url is_expected.to have_body_text group.web_url
is_expected.to have_body_text group_member.human_access is_expected.to have_body_text group_member.human_access
is_expected.to have_body_text group_member.invite_token is_expected.to have_body_text group_member.invite_token
...@@ -1080,10 +1080,10 @@ describe Notify do ...@@ -1080,10 +1080,10 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject 'Invitation accepted' is_expected.to have_subject 'Invitation accepted'
is_expected.to have_html_escaped_body_text group.name is_expected.to have_body_text group.name
is_expected.to have_body_text group.web_url is_expected.to have_body_text group.web_url
is_expected.to have_body_text group_member.invite_email is_expected.to have_body_text group_member.invite_email
is_expected.to have_html_escaped_body_text invited_user.name is_expected.to have_body_text invited_user.name
end end
end end
...@@ -1103,7 +1103,7 @@ describe Notify do ...@@ -1103,7 +1103,7 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
is_expected.to have_subject 'Invitation declined' is_expected.to have_subject 'Invitation declined'
is_expected.to have_html_escaped_body_text group.name is_expected.to have_body_text group.name
is_expected.to have_body_text group.web_url is_expected.to have_body_text group.web_url
is_expected.to have_body_text group_member.invite_email is_expected.to have_body_text group_member.invite_email
end end
...@@ -1396,7 +1396,7 @@ describe Notify do ...@@ -1396,7 +1396,7 @@ describe Notify do
it 'has the correct subject and body' do it 'has the correct subject and body' do
is_expected.to have_referable_subject(personal_snippet, reply: true) is_expected.to have_referable_subject(personal_snippet, reply: true)
is_expected.to have_html_escaped_body_text personal_snippet_note.note is_expected.to have_body_text personal_snippet_note.note
end end
end end
end end
RSpec::Matchers.define :have_html_escaped_body_text do |expected|
match do |actual|
expect(actual).to have_body_text(ERB::Util.html_escape(expected))
end
end
...@@ -212,7 +212,7 @@ shared_examples 'a note email' do ...@@ -212,7 +212,7 @@ shared_examples 'a note email' do
end end
it 'contains the message from the note' do it 'contains the message from the note' do
is_expected.to have_html_escaped_body_text note.note is_expected.to have_body_text note.note
end end
it 'does not contain note author' do it 'does not contain note author' do
...@@ -225,7 +225,7 @@ shared_examples 'a note email' do ...@@ -225,7 +225,7 @@ shared_examples 'a note email' do
end end
it 'contains a link to note author' do it 'contains a link to note author' do
is_expected.to have_html_escaped_body_text note.author_name is_expected.to have_body_text note.author_name
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment