user
end
- def User.add_to_project(user, project, roles)
+ def User.add_to_project(user, project, roles=nil)
+ roles = Role.find(1) if roles.nil?
roles = [roles] unless roles.is_a?(Array)
Member.create!(:principal => user, :project => project, :roles => roles)
end
assert_equal '2', issue.custom_field_value(field)
end
+ def test_add_issue_should_match_assignee_on_display_name
+ user = User.generate!(:firstname => 'Foo Bar', :lastname => 'Foo Baz')
+ User.add_to_project(user, Project.find(2))
+ issue = submit_email('ticket_on_given_project.eml') do |email|
+ email.sub!(/^Assigned to.*$/, 'Assigned to: Foo Bar Foo baz')
+ end
+ assert issue.is_a?(Issue)
+ assert_equal user, issue.assigned_to
+ end
+
def test_add_issue_with_cc
issue = submit_email('ticket_with_cc.eml', :issue => {:project => 'ecookbook'})
assert issue.is_a?(Issue)