GitLab steht Mittwoch, den 23. September, zwischen 10:00 und 12:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit e19526c2 authored by Stephen Holdaway's avatar Stephen Holdaway

Fix several_namespaces? to work with multiple ownership of groups

parent c7cb7599
...@@ -322,7 +322,7 @@ class User < ActiveRecord::Base ...@@ -322,7 +322,7 @@ class User < ActiveRecord::Base
end end
def several_namespaces? def several_namespaces?
namespaces.many? namespaces.many? || owned_groups.any?
end end
def namespace_id def namespace_id
......
...@@ -139,6 +139,19 @@ describe User do ...@@ -139,6 +139,19 @@ describe User do
it { @user.owned_groups.should == [@group] } it { @user.owned_groups.should == [@group] }
end end
describe 'group multiple owners' do
before do
ActiveRecord::Base.observers.enable(:user_observer)
@user = create :user
@user2 = create :user
@group = create :group, owner: @user
@group.add_users([@user2.id], UsersGroup::OWNER)
end
it { @user2.several_namespaces?.should be_true }
end
describe 'namespaced' do describe 'namespaced' do
before do before do
ActiveRecord::Base.observers.enable(:user_observer) ActiveRecord::Base.observers.enable(:user_observer)
......
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