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) ...@@ -8,10 +8,10 @@ def project_access_granted_email(user_project_id)
end end
def project_was_moved_email(user_project_id) def project_was_moved_email(project_id, user_id)
@users_project = UsersProject.find user_project_id @user = User.find user_id
@project = @users_project.project @project = Project.find project_id
mail(to: @users_project.user.email, mail(to: @user.email,
subject: subject("project was moved")) subject: subject("project was moved"))
end end
end end
......
...@@ -246,8 +246,8 @@ def items_for entity ...@@ -246,8 +246,8 @@ def items_for entity
end end
def send_move_instructions def send_move_instructions
self.users_projects.each do |member| team.members.each do |user|
Notify.delay.project_was_moved_email(member.id) Notify.delay.project_was_moved_email(self.id, user.id)
end end
end end
......
...@@ -218,6 +218,24 @@ ...@@ -218,6 +218,24 @@
end end
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 describe 'project access changed' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:user) { create(:user) } 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