Commit f709e99f authored by Lin Jen-Shin's avatar Lin Jen-Shin

Move EE specific tests to their own file

parent a251b8f6
......@@ -195,4 +195,63 @@ describe Notify do
end
end
end
describe 'mirror was hard failed' do
let(:project) { create(:project, :mirror, :import_hard_failed) }
subject { described_class.mirror_was_hard_failed_email(project.id, user.id) }
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
it_behaves_like "a user cannot unsubscribe through footer link"
it 'has the correct subject and body' do
is_expected.to have_subject("#{project.name} | Repository mirroring paused")
is_expected.to have_body_text(project.full_path)
is_expected.to have_body_text(project_settings_repository_url(project))
end
end
describe 'mirror user changed' do
let(:mirror_user) { create(:user) }
let(:project) { create(:project, :mirror, mirror_user_id: mirror_user.id) }
let(:new_mirror_user) { project.team.owners.first }
subject { described_class.project_mirror_user_changed_email(new_mirror_user.id, mirror_user.name, project.id) }
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
it_behaves_like "a user cannot unsubscribe through footer link"
it 'has the correct subject and body' do
is_expected.to have_subject("#{project.name} | Mirror user changed")
is_expected.to have_body_text(project.full_path)
end
end
describe 'admin notification' do
let(:example_site_path) { root_path }
let(:user) { create(:user) }
subject { @email = described_class.send_admin_notification(user.id, 'Admin announcement', 'Text') }
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq("GitLab")
expect(sender.address).to eq(gitlab_sender)
end
it 'is sent to recipient' do
is_expected.to deliver_to user.email
end
it 'has the correct subject' do
is_expected.to have_subject 'Admin announcement'
end
it 'includes unsubscribe link' do
unsubscribe_link = "http://localhost/unsubscribes/#{Base64.urlsafe_encode64(user.email)}"
is_expected.to have_body_text(unsubscribe_link)
end
end
end
......@@ -1359,65 +1359,6 @@ describe Notify do
end
end
describe 'mirror was hard failed' do
let(:project) { create(:project, :mirror, :import_hard_failed) }
subject { described_class.mirror_was_hard_failed_email(project.id, user.id) }
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
it_behaves_like "a user cannot unsubscribe through footer link"
it 'has the correct subject and body' do
is_expected.to have_subject("#{project.name} | Repository mirroring paused")
is_expected.to have_body_text(project.full_path)
is_expected.to have_body_text(project_settings_repository_url(project))
end
end
describe 'mirror user changed' do
let(:mirror_user) { create(:user) }
let(:project) { create(:project, :mirror, mirror_user_id: mirror_user.id) }
let(:new_mirror_user) { project.team.owners.first }
subject { described_class.project_mirror_user_changed_email(new_mirror_user.id, mirror_user.name, project.id) }
it_behaves_like 'an email sent from GitLab'
it_behaves_like 'it should not have Gmail Actions links'
it_behaves_like "a user cannot unsubscribe through footer link"
it 'has the correct subject and body' do
is_expected.to have_subject("#{project.name} | Mirror user changed")
is_expected.to have_body_text(project.full_path)
end
end
describe 'admin notification' do
let(:example_site_path) { root_path }
let(:user) { create(:user) }
subject { @email = described_class.send_admin_notification(user.id, 'Admin announcement', 'Text') }
it 'is sent as the author' do
sender = subject.header[:from].addrs[0]
expect(sender.display_name).to eq("GitLab")
expect(sender.address).to eq(gitlab_sender)
end
it 'is sent to recipient' do
is_expected.to deliver_to user.email
end
it 'has the correct subject' do
is_expected.to have_subject 'Admin announcement'
end
it 'includes unsubscribe link' do
unsubscribe_link = "http://localhost/unsubscribes/#{Base64.urlsafe_encode64(user.email)}"
is_expected.to have_body_text(unsubscribe_link)
end
end
describe 'HTML emails setting' do
let(:multipart_mail) { described_class.project_was_moved_email(project.id, user.id, "gitlab/gitlab") }
......
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