summaryrefslogtreecommitdiffstats
path: root/test/unit/member_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-08 20:36:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-08 20:36:22 +0000
commit9c6ba6653981b9ae921d1ca115946bc1fc39d3af (patch)
tree2895500b838daa7079c3744bf56ceafc10ea1b90 /test/unit/member_test.rb
parent109d6de0c53dcf2d77d9daea8ab50947507f6ca2 (diff)
downloadredmine-9c6ba6653981b9ae921d1ca115946bc1fc39d3af.tar.gz
redmine-9c6ba6653981b9ae921d1ca115946bc1fc39d3af.zip
Adds a test for #25289.
git-svn-id: http://svn.redmine.org/redmine/trunk@16382 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/member_test.rb')
-rw-r--r--test/unit/member_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/unit/member_test.rb b/test/unit/member_test.rb
index ce9898f4b..344aec7b9 100644
--- a/test/unit/member_test.rb
+++ b/test/unit/member_test.rb
@@ -196,4 +196,15 @@ class MemberTest < ActiveSupport::TestCase
member.roles << Role.generate!(:all_roles_managed => true)
assert_equal [], member.managed_roles
end
+
+ def test_create_principal_memberships_should_not_error_with_2_projects_and_inheritance
+ parent = Project.generate!
+ child = Project.generate!(:parent_id => parent.id, :inherit_members => true)
+ user = User.generate!
+
+ assert_difference 'Member.count', 2 do
+ members = Member.create_principal_memberships(user, :project_ids => [parent.id, child.id], :role_ids => [1])
+ assert members.none?(&:new_record?), "Unsaved members were returned: #{members.select(&:new_record?).map{|m| m.errors.full_messages}*","}"
+ end
+ end
end