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
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
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) }