Commit e46a1af1 authored by Vijay Hawoldar's avatar Vijay Hawoldar

Improve active member test and query

parent d74a9d99
......@@ -148,7 +148,7 @@ module EE
def set_membership_activation
return unless group
return if user && ::Member.in_hierarchy(group.root_ancestor).with_user(user).with_state(:active).limit(1).any?
return if user && ::Member.in_hierarchy(group).with_user(user).with_state(:active).any?
self.state = ::Member::STATE_AWAITING if group.user_cap_reached?
end
......
......@@ -244,8 +244,8 @@ RSpec.describe Member, type: :model do
context 'when the user is already an active project member' do
it 'sets the group member to active' do
create(:project_member, :active, project: project, user: user)
subgroup.add_owner(user)
expect { subgroup.add_owner(user) }.to change { ::Member.with_state(:active).count }.by(1)
expect(user.group_members.last).to be_active
end
end
......
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