diff options
-rw-r--r-- | app/models/project.rb | 4 | ||||
-rw-r--r-- | test/unit/project_test.rb | 10 |
2 files changed, 11 insertions, 3 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 4824271..16d4a39 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -289,7 +289,9 @@ class Project < ActiveRecord::Base self.wiki_repository.owner = another_owner repositories.mainlines.each {|repo| - repo.committerships.create!(:committer => another_owner, :creator_id => self.owner_id_was) + c = repo.committerships.create!(:committer => another_owner,:creator_id => self.owner_id_was) + c.build_permissions(:review, :commit, :admin) + c.save! } end end diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb index 9114a06..e61fe31 100644 --- a/test/unit/project_test.rb +++ b/test/unit/project_test.rb @@ -213,10 +213,16 @@ class ProjectTest < ActiveSupport::TestCase assert_equal groups(:team_thunderbird), p.owner end - should "add group as committer to mainline repositories when changing ownership" do + should "add group as admin to mainline repositories when changing ownership" do p = projects(:johans) assert_difference("Committership.count") { p.change_owner_to(groups(:team_thunderbird)) } - assert p.repositories.mainlines.first.committerships.any? {|c| c.committer == groups(:team_thunderbird) } + committership = p.repositories.mainlines.first.committerships.detect { |c| + c.committer == groups(:team_thunderbird) + } + assert_not_nil committership + assert_equal( + Committership::CAN_REVIEW | Committership::CAN_COMMIT | Committership::CAN_ADMIN, + committership.permissions) end should "delegate wiki permissions to the wiki repository" do |