Skip to content
Snippets Groups Projects
Commit d73d2a5e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce

parents 69e9c414 f41634c7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -28,6 +28,8 @@ module EmailsHelper
return "View #{action.humanize.singularize}"
end
end
nil
end
 
def color_email_diff(diffcontent)
Loading
Loading
Loading
Loading
@@ -77,6 +77,32 @@ describe Notify do
end
end
 
shared_examples 'it should have Gmail Actions links' do
it { is_expected.to have_body_text /ViewAction/ }
end
shared_examples 'it should not have Gmail Actions links' do
it { is_expected.to_not have_body_text /ViewAction/ }
end
shared_examples 'it should show Gmail Actions View Issue link' do
it_behaves_like 'it should have Gmail Actions links'
it { is_expected.to have_body_text /View Issue/ }
end
shared_examples 'it should show Gmail Actions View Merge request link' do
it_behaves_like 'it should have Gmail Actions links'
it { is_expected.to have_body_text /View Merge request/ }
end
shared_examples 'it should show Gmail Actions View Commit link' do
it_behaves_like 'it should have Gmail Actions links'
it { is_expected.to have_body_text /View Commit/ }
end
describe 'for new users, the email' do
let(:example_site_path) { root_path }
let(:new_user) { create(:user, email: new_user_address, created_by_id: 1) }
Loading
Loading
@@ -87,6 +113,7 @@ describe Notify do
 
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'a new user email', new_user_address
it_behaves_like 'it should not have Gmail Actions links'
 
it 'contains the password text' do
is_expected.to have_body_text /Click here to set your password/
Loading
Loading
@@ -115,6 +142,7 @@ describe Notify do
 
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'a new user email', new_user_address
it_behaves_like 'it should not have Gmail Actions links'
 
it 'should not contain the new user\'s password' do
is_expected.not_to have_body_text /password/
Loading
Loading
@@ -127,6 +155,7 @@ describe Notify do
subject { Notify.new_ssh_key_email(key.id) }
 
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
 
it 'is sent to the new user' do
is_expected.to deliver_to key.user.email
Loading
Loading
@@ -150,6 +179,8 @@ describe Notify do
 
subject { Notify.new_email_email(email.id) }
 
it_behaves_like 'it should not have Gmail Actions links'
it 'is sent to the new user' do
is_expected.to deliver_to email.user.email
end
Loading
Loading
@@ -194,6 +225,7 @@ describe Notify do
 
it_behaves_like 'an assignee email'
it_behaves_like 'an email starting a new thread', 'issue'
it_behaves_like 'it should show Gmail Actions View Issue link'
 
it 'has the correct subject' do
is_expected.to have_subject /#{project.name} \| #{issue.title} \(##{issue.iid}\)/
Loading
Loading
@@ -207,6 +239,8 @@ describe Notify do
describe 'that are new with a description' do
subject { Notify.new_issue_email(issue_with_description.assignee_id, issue_with_description.id) }
 
it_behaves_like 'it should show Gmail Actions View Issue link'
it 'contains the description' do
is_expected.to have_body_text /#{issue_with_description.description}/
end
Loading
Loading
@@ -217,6 +251,7 @@ describe Notify do
 
it_behaves_like 'a multiple recipients email'
it_behaves_like 'an answer to an existing thread', 'issue'
it_behaves_like 'it should show Gmail Actions View Issue link'
 
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
Loading
Loading
@@ -246,6 +281,7 @@ describe Notify do
subject { Notify.issue_status_changed_email(recipient.id, issue.id, status, current_user) }
 
it_behaves_like 'an answer to an existing thread', 'issue'
it_behaves_like 'it should show Gmail Actions View Issue link'
 
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
Loading
Loading
@@ -269,7 +305,6 @@ describe Notify do
is_expected.to have_body_text /#{namespace_project_issue_path project.namespace, project, issue}/
end
end
end
 
context 'for merge requests' do
Loading
Loading
@@ -282,6 +317,7 @@ describe Notify do
 
it_behaves_like 'an assignee email'
it_behaves_like 'an email starting a new thread', 'merge_request'
it_behaves_like 'it should show Gmail Actions View Merge request link'
 
it 'has the correct subject' do
is_expected.to have_subject /#{merge_request.title} \(##{merge_request.iid}\)/
Loading
Loading
@@ -307,6 +343,8 @@ describe Notify do
describe 'that are new with a description' do
subject { Notify.new_merge_request_email(merge_request_with_description.assignee_id, merge_request_with_description.id) }
 
it_behaves_like 'it should show Gmail Actions View Merge request link'
it 'contains the description' do
is_expected.to have_body_text /#{merge_request_with_description.description}/
end
Loading
Loading
@@ -317,6 +355,7 @@ describe Notify do
 
it_behaves_like 'a multiple recipients email'
it_behaves_like 'an answer to an existing thread', 'merge_request'
it_behaves_like 'it should show Gmail Actions View Merge request link'
 
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
Loading
Loading
@@ -346,6 +385,7 @@ describe Notify do
subject { Notify.merge_request_status_email(recipient.id, merge_request.id, status, current_user) }
 
it_behaves_like 'an answer to an existing thread', 'merge_request'
it_behaves_like 'it should show Gmail Actions View Merge request link'
 
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
Loading
Loading
@@ -375,6 +415,7 @@ describe Notify do
 
it_behaves_like 'a multiple recipients email'
it_behaves_like 'an answer to an existing thread', 'merge_request'
it_behaves_like 'it should show Gmail Actions View Merge request link'
 
it 'is sent as the merge author' do
sender = subject.header[:from].addrs[0]
Loading
Loading
@@ -403,6 +444,7 @@ describe Notify do
subject { Notify.project_was_moved_email(project.id, user.id, "gitlab/gitlab") }
 
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
 
it 'has the correct subject' do
is_expected.to have_subject /Project was moved/
Loading
Loading
@@ -424,13 +466,16 @@ describe Notify do
subject { Notify.project_access_granted_email(project_member.id) }
 
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
 
it 'has the correct subject' do
is_expected.to have_subject /Access to project was granted/
end
it 'contains name of project' do
is_expected.to have_body_text /#{project.name}/
end
it 'contains new user role' do
is_expected.to have_body_text /#{project_member.human_access}/
end
Loading
Loading
@@ -445,6 +490,8 @@ describe Notify do
end
 
shared_examples 'a note email' do
it_behaves_like 'it should have Gmail Actions links'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(note_author.name)
Loading
Loading
@@ -469,6 +516,7 @@ describe Notify do
 
it_behaves_like 'a note email'
it_behaves_like 'an answer to an existing thread', 'commit'
it_behaves_like 'it should show Gmail Actions View Commit link'
 
it 'has the correct subject' do
is_expected.to have_subject /#{commit.title} \(#{commit.short_id}\)/
Loading
Loading
@@ -488,6 +536,7 @@ describe Notify do
 
it_behaves_like 'a note email'
it_behaves_like 'an answer to an existing thread', 'merge_request'
it_behaves_like 'it should show Gmail Actions View Merge request link'
 
it 'has the correct subject' do
is_expected.to have_subject /#{merge_request.title} \(##{merge_request.iid}\)/
Loading
Loading
@@ -507,6 +556,7 @@ describe Notify do
 
it_behaves_like 'a note email'
it_behaves_like 'an answer to an existing thread', 'issue'
it_behaves_like 'it should show Gmail Actions View Issue link'
 
it 'has the correct subject' do
is_expected.to have_subject /#{issue.title} \(##{issue.iid}\)/
Loading
Loading
@@ -527,6 +577,7 @@ describe Notify do
subject { Notify.group_access_granted_email(membership.id) }
 
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
 
it 'has the correct subject' do
is_expected.to have_subject /Access to group was granted/
Loading
Loading
@@ -574,6 +625,8 @@ describe Notify do
 
subject { Notify.repository_push_email(project.id, 'devs@company.name', author_id: user.id, ref: 'refs/heads/master', action: :create) }
 
it_behaves_like 'it should not have Gmail Actions links'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(user.name)
Loading
Loading
@@ -600,6 +653,8 @@ describe Notify do
 
subject { Notify.repository_push_email(project.id, 'devs@company.name', author_id: user.id, ref: 'refs/tags/v1.0', action: :create) }
 
it_behaves_like 'it should not have Gmail Actions links'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(user.name)
Loading
Loading
@@ -625,6 +680,8 @@ describe Notify do
 
subject { Notify.repository_push_email(project.id, 'devs@company.name', author_id: user.id, ref: 'refs/heads/master', action: :delete) }
 
it_behaves_like 'it should not have Gmail Actions links'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(user.name)
Loading
Loading
@@ -646,6 +703,8 @@ describe Notify do
 
subject { Notify.repository_push_email(project.id, 'devs@company.name', author_id: user.id, ref: 'refs/tags/v1.0', action: :delete) }
 
it_behaves_like 'it should not have Gmail Actions links'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(user.name)
Loading
Loading
@@ -671,6 +730,8 @@ describe Notify do
 
subject { Notify.repository_push_email(project.id, 'devs@company.name', author_id: user.id, ref: 'refs/heads/master', action: :push, compare: compare, reverse_compare: false, send_from_committer_email: send_from_committer_email) }
 
it_behaves_like 'it should not have Gmail Actions links'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(user.name)
Loading
Loading
@@ -774,6 +835,8 @@ describe Notify do
 
subject { Notify.repository_push_email(project.id, 'devs@company.name', author_id: user.id, ref: 'refs/heads/master', action: :push, compare: compare) }
 
it_behaves_like 'it should show Gmail Actions View Commit link'
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq(user.name)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment