Commit 1dd66061 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Send project transfer email to all members. Added specs for project move email

parent 5a78bcd1ecf4
......@@ -8,10 +8,10 @@ def project_access_granted_email(user_project_id)
end
def project_was_moved_email(user_project_id)
@users_project = UsersProject.find user_project_id
@project = @users_project.project
mail(to: @users_project.user.email,
def project_was_moved_email(project_id, user_id)
@user = User.find user_id
@project = Project.find project_id
mail(to: @user.email,
subject: subject("project was moved"))
end
end
......
......@@ -246,8 +246,8 @@ def items_for entity
end
def send_move_instructions
self.users_projects.each do |member|
Notify.delay.project_was_moved_email(member.id)
team.members.each do |user|
Notify.delay.project_was_moved_email(self.id, user.id)
end
end
......
......@@ -218,6 +218,24 @@
end
end
describe 'project was moved' do
let(:project) { create(:project) }
let(:user) { create(:user) }
subject { Notify.project_was_moved_email(project.id, user.id) }
it 'has the correct subject' do
should have_subject /project was moved/
end
it 'contains name of project' do
should have_body_text /#{project.name_with_namespace}/
end
it 'contains new user role' do
should have_body_text /#{project.ssh_url_to_repo}/
end
end
describe 'project access changed' do
let(:project) { create(:project) }
let(:user) { create(:user) }
......
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