Commit fe4a1865 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-intermittent-notify-spec' into 'master'

Fix intermittent spec failures in notify_spec.rb

See merge request !9935
parents 2d475dcd 283789c5
...@@ -8,6 +8,15 @@ describe Notify do ...@@ -8,6 +8,15 @@ describe Notify do
include_context 'gitlab email notification' include_context 'gitlab email notification'
def have_referable_subject(referable, reply: false)
prefix = referable.project.name if referable.project
prefix = "Re: #{prefix}" if reply
suffix = "#{referable.title} (#{referable.to_reference})"
have_subject [prefix, suffix].compact.join(' | ')
end
context 'for a project' do context 'for a project' do
describe 'items that are assignable, the email' do describe 'items that are assignable, the email' do
let(:current_user) { create(:user, email: "current@email.com") } let(:current_user) { create(:user, email: "current@email.com") }
...@@ -41,11 +50,11 @@ describe Notify do ...@@ -41,11 +50,11 @@ describe Notify do
it_behaves_like 'an unsubscribeable thread' it_behaves_like 'an unsubscribeable thread'
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{project.name} \| #{issue.title} \(##{issue.iid}\)/ is_expected.to have_referable_subject(issue)
end end
it 'contains a link to the new issue' do it 'contains a link to the new issue' do
is_expected.to have_body_text /#{namespace_project_issue_path project.namespace, project, issue}/ is_expected.to have_body_text namespace_project_issue_path(project.namespace, project, issue)
end end
context 'when enabled email_author_in_body' do context 'when enabled email_author_in_body' do
...@@ -55,7 +64,7 @@ describe Notify do ...@@ -55,7 +64,7 @@ describe Notify do
it 'contains a link to note author' do it 'contains a link to note author' do
is_expected.to have_body_text issue.author_name is_expected.to have_body_text issue.author_name
is_expected.to have_body_text /wrote\:/ is_expected.to have_body_text 'wrote:'
end end
end end
end end
...@@ -66,7 +75,7 @@ describe Notify do ...@@ -66,7 +75,7 @@ describe Notify do
it_behaves_like 'it should show Gmail Actions View Issue link' it_behaves_like 'it should show Gmail Actions View Issue link'
it 'contains the description' do it 'contains the description' do
is_expected.to have_body_text /#{issue_with_description.description}/ is_expected.to have_body_text issue_with_description.description
end end
end end
...@@ -87,19 +96,19 @@ describe Notify do ...@@ -87,19 +96,19 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{issue.title} \(##{issue.iid}\)/ is_expected.to have_referable_subject(issue, reply: true)
end end
it 'contains the name of the previous assignee' do it 'contains the name of the previous assignee' do
is_expected.to have_body_text /#{previous_assignee.name}/ is_expected.to have_body_text previous_assignee.name
end end
it 'contains the name of the new assignee' do it 'contains the name of the new assignee' do
is_expected.to have_body_text /#{assignee.name}/ is_expected.to have_body_text assignee.name
end end
it 'contains a link to the issue' do it 'contains a link to the issue' do
is_expected.to have_body_text /#{namespace_project_issue_path project.namespace, project, issue}/ is_expected.to have_body_text namespace_project_issue_path(project.namespace, project, issue)
end end
end end
...@@ -121,15 +130,15 @@ describe Notify do ...@@ -121,15 +130,15 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{issue.title} \(##{issue.iid}\)/ is_expected.to have_referable_subject(issue, reply: true)
end end
it 'contains the names of the added labels' do it 'contains the names of the added labels' do
is_expected.to have_body_text /foo, bar, and baz/ is_expected.to have_body_text 'foo, bar, and baz'
end end
it 'contains a link to the issue' do it 'contains a link to the issue' do
is_expected.to have_body_text /#{namespace_project_issue_path project.namespace, project, issue}/ is_expected.to have_body_text namespace_project_issue_path(project.namespace, project, issue)
end end
end end
...@@ -150,19 +159,19 @@ describe Notify do ...@@ -150,19 +159,19 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{issue.title} \(##{issue.iid}\)/i is_expected.to have_referable_subject(issue, reply: true)
end end
it 'contains the new status' do it 'contains the new status' do
is_expected.to have_body_text /#{status}/i is_expected.to have_body_text status
end end
it 'contains the user name' do it 'contains the user name' do
is_expected.to have_body_text /#{current_user.name}/i is_expected.to have_body_text current_user.name
end end
it 'contains a link to the issue' do it 'contains a link to the issue' do
is_expected.to have_body_text /#{namespace_project_issue_path project.namespace, project, issue}/ is_expected.to have_body_text(namespace_project_issue_path project.namespace, project, issue)
end end
end end
...@@ -181,7 +190,7 @@ describe Notify do ...@@ -181,7 +190,7 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{issue.title} \(##{issue.iid}\)/i is_expected.to have_referable_subject(issue, reply: true)
end end
it 'contains link to new issue' do it 'contains link to new issue' do
...@@ -191,7 +200,7 @@ describe Notify do ...@@ -191,7 +200,7 @@ describe Notify do
end end
it 'contains a link to the original issue' do it 'contains a link to the original issue' do
is_expected.to have_body_text /#{namespace_project_issue_path project.namespace, project, issue}/ is_expected.to have_body_text namespace_project_issue_path(project.namespace, project, issue)
end end
end end
end end
...@@ -212,19 +221,19 @@ describe Notify do ...@@ -212,19 +221,19 @@ describe Notify do
it_behaves_like 'an unsubscribeable thread' it_behaves_like 'an unsubscribeable thread'
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{merge_request.title} \(#{merge_request.to_reference}\)/ is_expected.to have_referable_subject(merge_request)
end end
it 'contains a link to the new merge request' do it 'contains a link to the new merge request' do
is_expected.to have_body_text /#{namespace_project_merge_request_path(project.namespace, project, merge_request)}/ is_expected.to have_body_text namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
it 'contains the source branch for the merge request' do it 'contains the source branch for the merge request' do
is_expected.to have_body_text /#{merge_request.source_branch}/ is_expected.to have_body_text merge_request.source_branch
end end
it 'contains the target branch for the merge request' do it 'contains the target branch for the merge request' do
is_expected.to have_body_text /#{merge_request.target_branch}/ is_expected.to have_body_text merge_request.target_branch
end end
context 'when enabled email_author_in_body' do context 'when enabled email_author_in_body' do
...@@ -234,7 +243,7 @@ describe Notify do ...@@ -234,7 +243,7 @@ describe Notify do
it 'contains a link to note author' do it 'contains a link to note author' do
is_expected.to have_body_text merge_request.author_name is_expected.to have_body_text merge_request.author_name
is_expected.to have_body_text /wrote\:/ is_expected.to have_body_text 'wrote:'
end end
end end
end end
...@@ -246,7 +255,7 @@ describe Notify do ...@@ -246,7 +255,7 @@ describe Notify do
it_behaves_like "an unsubscribeable thread" it_behaves_like "an unsubscribeable thread"
it 'contains the description' do it 'contains the description' do
is_expected.to have_body_text /#{merge_request_with_description.description}/ is_expected.to have_body_text merge_request_with_description.description
end end
end end
...@@ -267,19 +276,19 @@ describe Notify do ...@@ -267,19 +276,19 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{merge_request.title} \(#{merge_request.to_reference}\)/ is_expected.to have_referable_subject(merge_request, reply: true)
end end
it 'contains the name of the previous assignee' do it 'contains the name of the previous assignee' do
is_expected.to have_body_text /#{previous_assignee.name}/ is_expected.to have_body_text previous_assignee.name
end end
it 'contains the name of the new assignee' do it 'contains the name of the new assignee' do
is_expected.to have_body_text /#{assignee.name}/ is_expected.to have_body_text assignee.name
end end
it 'contains a link to the merge request' do it 'contains a link to the merge request' do
is_expected.to have_body_text /#{namespace_project_merge_request_path project.namespace, project, merge_request}/ is_expected.to have_body_text namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
end end
...@@ -301,15 +310,15 @@ describe Notify do ...@@ -301,15 +310,15 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{merge_request.title} \(#{merge_request.to_reference}\)/ is_expected.to have_referable_subject(merge_request, reply: true)
end end
it 'contains the names of the added labels' do it 'contains the names of the added labels' do
is_expected.to have_body_text /foo, bar, and baz/ is_expected.to have_body_text 'foo, bar, and baz'
end end
it 'contains a link to the merge request' do it 'contains a link to the merge request' do
is_expected.to have_body_text /#{namespace_project_merge_request_path project.namespace, project, merge_request}/ is_expected.to have_body_text namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
end end
...@@ -330,19 +339,19 @@ describe Notify do ...@@ -330,19 +339,19 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{merge_request.title} \(#{merge_request.to_reference}\)/i is_expected.to have_referable_subject(merge_request, reply: true)
end end
it 'contains the new status' do it 'contains the new status' do
is_expected.to have_body_text /#{status}/i is_expected.to have_body_text status
end end
it 'contains the user name' do it 'contains the user name' do
is_expected.to have_body_text /#{current_user.name}/i is_expected.to have_body_text current_user.name
end end
it 'contains a link to the merge request' do it 'contains a link to the merge request' do
is_expected.to have_body_text /#{namespace_project_merge_request_path project.namespace, project, merge_request}/ is_expected.to have_body_text namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
end end
...@@ -363,15 +372,15 @@ describe Notify do ...@@ -363,15 +372,15 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{merge_request.title} \(#{merge_request.to_reference}\)/ is_expected.to have_referable_subject(merge_request, reply: true)
end end
it 'contains the new status' do it 'contains the new status' do
is_expected.to have_body_text /merged/i is_expected.to have_body_text 'merged'
end end
it 'contains a link to the merge request' do it 'contains a link to the merge request' do
is_expected.to have_body_text /#{namespace_project_merge_request_path project.namespace, project, merge_request}/ is_expected.to have_body_text namespace_project_merge_request_path(project.namespace, project, merge_request)
end end
end end
end end
...@@ -387,15 +396,15 @@ describe Notify do ...@@ -387,15 +396,15 @@ describe Notify do
it_behaves_like "a user cannot unsubscribe through footer link" it_behaves_like "a user cannot unsubscribe through footer link"
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /Project was moved/ is_expected.to have_subject "#{project.name} | Project was moved"
end end
it 'contains name of project' do it 'contains name of project' do
is_expected.to have_body_text /#{project.name_with_namespace}/ is_expected.to have_body_text project.name_with_namespace
end end
it 'contains new user role' do it 'contains new user role' do
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
...@@ -424,9 +433,9 @@ describe Notify do ...@@ -424,9 +433,9 @@ describe Notify do
expect(to_emails[0].address).to eq(project.members.owners_and_masters.first.user.notification_email) expect(to_emails[0].address).to eq(project.members.owners_and_masters.first.user.notification_email)
is_expected.to have_subject "Request to join the #{project.name_with_namespace} project" is_expected.to have_subject "Request to join the #{project.name_with_namespace} project"
is_expected.to have_body_text /#{project.name_with_namespace}/ is_expected.to have_body_text project.name_with_namespace
is_expected.to have_body_text /#{namespace_project_project_members_url(project.namespace, project)}/ is_expected.to have_body_text namespace_project_project_members_url(project.namespace, project)
is_expected.to have_body_text /#{project_member.human_access}/ is_expected.to have_body_text project_member.human_access
end end
end end
...@@ -451,9 +460,9 @@ describe Notify do ...@@ -451,9 +460,9 @@ describe Notify do
expect(to_emails[0].address).to eq(group.members.owners_and_masters.first.user.notification_email) expect(to_emails[0].address).to eq(group.members.owners_and_masters.first.user.notification_email)
is_expected.to have_subject "Request to join the #{project.name_with_namespace} project" is_expected.to have_subject "Request to join the #{project.name_with_namespace} project"
is_expected.to have_body_text /#{project.name_with_namespace}/ is_expected.to have_body_text project.name_with_namespace
is_expected.to have_body_text /#{namespace_project_project_members_url(project.namespace, project)}/ is_expected.to have_body_text namespace_project_project_members_url(project.namespace, project)
is_expected.to have_body_text /#{project_member.human_access}/ is_expected.to have_body_text project_member.human_access
end end
end end
end end
...@@ -473,8 +482,8 @@ describe Notify do ...@@ -473,8 +482,8 @@ 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.name_with_namespace} project was denied" is_expected.to have_subject "Access to the #{project.name_with_namespace} project was denied"
is_expected.to have_body_text /#{project.name_with_namespace}/ is_expected.to have_body_text project.name_with_namespace
is_expected.to have_body_text /#{project.web_url}/ is_expected.to have_body_text project.web_url
end end
end end
...@@ -490,9 +499,9 @@ describe Notify do ...@@ -490,9 +499,9 @@ 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.name_with_namespace} project was granted" is_expected.to have_subject "Access to the #{project.name_with_namespace} project was granted"
is_expected.to have_body_text /#{project.name_with_namespace}/ is_expected.to have_body_text project.name_with_namespace
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
end end
...@@ -521,10 +530,10 @@ describe Notify do ...@@ -521,10 +530,10 @@ 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.name_with_namespace} project" is_expected.to have_subject "Invitation to join the #{project.name_with_namespace} project"
is_expected.to have_body_text /#{project.name_with_namespace}/ is_expected.to have_body_text project.name_with_namespace
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
is_expected.to have_body_text /#{project_member.invite_token}/ is_expected.to have_body_text project_member.invite_token
end end
end end
...@@ -546,10 +555,10 @@ describe Notify do ...@@ -546,10 +555,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_body_text /#{project.name_with_namespace}/ is_expected.to have_body_text project.name_with_namespace
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_body_text /#{invited_user.name}/ is_expected.to have_body_text invited_user.name
end end
end end
...@@ -570,9 +579,9 @@ describe Notify do ...@@ -570,9 +579,9 @@ 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_body_text /#{project.name_with_namespace}/ is_expected.to have_body_text project.name_with_namespace
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
end end
...@@ -598,11 +607,11 @@ describe Notify do ...@@ -598,11 +607,11 @@ 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_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
is_expected.not_to have_body_text /wrote\:/ is_expected.not_to have_body_text 'wrote:'
end end
context 'when enabled email_author_in_body' do context 'when enabled email_author_in_body' do
...@@ -612,7 +621,7 @@ describe Notify do ...@@ -612,7 +621,7 @@ describe Notify do
it 'contains a link to note author' do it 'contains a link to note author' do
is_expected.to have_body_text note.author_name is_expected.to have_body_text note.author_name
is_expected.to have_body_text /wrote\:/ is_expected.to have_body_text 'wrote:'
end end
end end
end end
...@@ -632,7 +641,7 @@ describe Notify do ...@@ -632,7 +641,7 @@ describe Notify do
it_behaves_like 'a user cannot unsubscribe through footer link' it_behaves_like 'a user cannot unsubscribe through footer link'
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /Re: #{project.name} | #{commit.title} \(#{commit.short_id}\)/ is_expected.to have_subject "Re: #{project.name} | #{commit.title.strip} (#{commit.short_id})"
end end
it 'contains a link to the commit' do it 'contains a link to the commit' do
...@@ -655,11 +664,11 @@ describe Notify do ...@@ -655,11 +664,11 @@ describe Notify do
it_behaves_like 'an unsubscribeable thread' it_behaves_like 'an unsubscribeable thread'
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{merge_request.title} \(#{merge_request.to_reference}\)/ is_expected.to have_referable_subject(merge_request, reply: true)
end end
it 'contains a link to the merge request note' do it 'contains a link to the merge request note' do
is_expected.to have_body_text /#{note_on_merge_request_path}/ is_expected.to have_body_text note_on_merge_request_path
end end
end end
...@@ -678,11 +687,11 @@ describe Notify do ...@@ -678,11 +687,11 @@ describe Notify do
it_behaves_like 'an unsubscribeable thread' it_behaves_like 'an unsubscribeable thread'
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{issue.title} \(##{issue.iid}\)/ is_expected.to have_referable_subject(issue, reply: true)
end end
it 'contains a link to the issue note' do it 'contains a link to the issue note' do
is_expected.to have_body_text /#{note_on_issue_path}/ is_expected.to have_body_text note_on_issue_path
end end
end end
end end
...@@ -698,11 +707,11 @@ describe Notify do ...@@ -698,11 +707,11 @@ describe Notify do
let(:note) { create(model, project: project, author: note_author) } let(:note) { create(model, project: project, author: note_author) }
it "includes diffs with character-level highlighting" do it "includes diffs with character-level highlighting" do
is_expected.to have_body_text /<span class=\"p\">}<\/span><\/span>/ is_expected.to have_body_text '<span class="p">}</span></span>'
end end
it 'contains a link to the diff file' do it 'contains a link to the diff file' do
is_expected.to have_body_text /#{note.diff_file.file_path}/ is_expected.to have_body_text note.diff_file.file_path
end end
it_behaves_like 'it should have Gmail Actions links' it_behaves_like 'it should have Gmail Actions links'
...@@ -718,11 +727,11 @@ describe Notify do ...@@ -718,11 +727,11 @@ 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_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
is_expected.not_to have_body_text /wrote\:/ is_expected.not_to have_body_text 'wrote:'
end end
context 'when enabled email_author_in_body' do context 'when enabled email_author_in_body' do
...@@ -732,7 +741,7 @@ describe Notify do ...@@ -732,7 +741,7 @@ describe Notify do
it 'contains a link to note author' do it 'contains a link to note author' do
is_expected.to have_body_text note.author_name is_expected.to have_body_text note.author_name
is_expected.to have_body_text /wrote\:/ is_expected.to have_body_text 'wrote:'
end end
end end
end end
...@@ -777,9 +786,9 @@ describe Notify do ...@@ -777,9 +786,9 @@ describe Notify do
it 'contains all the useful information' do it 'contains all the useful information' do
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_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
end end
...@@ -798,8 +807,8 @@ describe Notify do ...@@ -798,8 +807,8 @@ 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_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
...@@ -816,9 +825,9 @@ describe Notify do ...@@ -816,9 +825,9 @@ 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_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
end end
...@@ -847,10 +856,10 @@ describe Notify do ...@@ -847,10 +856,10 @@ 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_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
end end
end end
...@@ -872,10 +881,10 @@ describe Notify do ...@@ -872,10 +881,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_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_body_text /#{invited_user.name}/ is_expected.to have_body_text invited_user.name
end end
end end
...@@ -896,9 +905,9 @@ describe Notify do ...@@ -896,9 +905,9 @@ 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_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
end end
end end
...@@ -925,11 +934,11 @@ describe Notify do ...@@ -925,11 +934,11 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /^Confirmation instructions/ is_expected.to have_subject 'Confirmation instructions | A Nice Suffix'
end end
it 'includes a link to the site' do it 'includes a link to the site' do
is_expected.to have_body_text /#{example_site_path}/ is_expected.to have_body_text example_site_path
end end
end end
...@@ -952,11 +961,11 @@ describe Notify do ...@@ -952,11 +961,11 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /Pushed new branch master/ is_expected.to have_subject "[Git][#{project.full_path}] Pushed new branch master"
end end
it 'contains a link to the branch' do it 'contains a link to the branch' do
is_expected.to have_body_text /#{tree_path}/ is_expected.to have_body_text tree_path
end end
end end
...@@ -979,11 +988,11 @@ describe Notify do ...@@ -979,11 +988,11 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /Pushed new tag v1\.0/ is_expected.to have_subject "[Git][#{project.full_path}] Pushed new tag v1.0"
end end
it 'contains a link to the tag' do it 'contains a link to the tag' do
is_expected.to have_body_text /#{tree_path}/ is_expected.to have_body_text tree_path
end end
end end
...@@ -1005,7 +1014,7 @@ describe Notify do ...@@ -1005,7 +1014,7 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /Deleted branch master/ is_expected.to have_subject "[Git][#{project.full_path}] Deleted branch master"
end end
end end
...@@ -1027,7 +1036,7 @@ describe Notify do ...@@ -1027,7 +1036,7 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /Deleted tag v1\.0/ is_expected.to have_subject "[Git][#{project.full_path}] Deleted tag v1.0"
end end
end end
...@@ -1055,23 +1064,23 @@ describe Notify do ...@@ -1055,23 +1064,23 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /\[#{project.path_with_namespace}\]\[master\] #{commits.length} commits:/ is_expected.to have_subject "[Git][#{project.full_path}][master] #{commits.length} commits: Ruby files modified"
end end
it 'includes commits list' do it 'includes commits list' do
is_expected.to have_body_text /Change some files/ is_expected.to have_body_text 'Change some files'
end end
it 'includes diffs with character-level highlighting' do it 'includes diffs with character-level highlighting' do
is_expected.to have_body_text /def<\/span> <span class=\"nf\">archive_formats_regex/ is_expected.to have_body_text 'def</span> <span class="nf">archive_formats_regex'
end end
it 'contains a link to the diff' do it 'contains a link to the diff' do
is_expected.to have_body_text /#{diff_path}/ is_expected.to have_body_text diff_path
end end
it 'does not contain the misleading footer' do it 'does not contain the misleading footer' do
is_expected.not_to have_body_text /you are a member of/ is_expected.not_to have_body_text 'you are a member of'
end end
context "when set to send from committer email if domain matches" do context "when set to send from committer email if domain matches" do
...@@ -1157,19 +1166,19 @@ describe Notify do ...@@ -1157,19 +1166,19 @@ describe Notify do
end end
it 'has the correct subject' do it 'has the correct subject' do
is_expected.to have_subject /#{commits.first.title}/ is_expected.to have_subject "[Git][#{project.full_path}][master] #{commits.first.title}"
end end
it 'includes commits list' do it 'includes commits list' do
is_expected.to have_body_text /Change some files/ is_expected.to have_body_text 'Change some files'
end end
it 'includes diffs with character-level highlighting' do it 'includes diffs with character-level highlighting' do
is_expected.to have_body_text /def<\/span> <span class=\"nf\">archive_formats_regex/ is_expected.to have_body_text 'def</span> <span class="nf">archive_formats_regex'
end end
it 'contains a link to the diff' do it 'contains a link to the diff' do
is_expected.to have_body_text /#{diff_path}/ is_expected.to have_body_text diff_path
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