diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-02-18 16:39:59 -0500 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-02-18 16:39:59 -0500 |
commit | 924463907db6dcb284b3dc376a66986b4ca369aa (patch) | |
tree | d0ea9c82ef44507715342bca3b054f8d9bf13747 | |
parent | c04e22fba8d130a58f498ff48127712d7dae17ee (diff) | |
download | gitlab-ce-924463907db6dcb284b3dc376a66986b4ca369aa.tar.gz |
Allow `ProjectTeam#human_max_access` to return "Owner"rs-show-owner-label
-rw-r--r-- | app/models/project_team.rb | 2 | ||||
-rw-r--r-- | spec/models/project_team_spec.rb | 26 |
2 files changed, 19 insertions, 9 deletions
diff --git a/app/models/project_team.rb b/app/models/project_team.rb index 9f380a382cb..9629c7e1bb9 100644 --- a/app/models/project_team.rb +++ b/app/models/project_team.rb @@ -136,7 +136,7 @@ class ProjectTeam end def human_max_access(user_id) - Gitlab::Access.options.key max_member_access(user_id) + Gitlab::Access.options_with_owner.key(max_member_access(user_id)) end # This method assumes project and group members are eager loaded for optimal diff --git a/spec/models/project_team_spec.rb b/spec/models/project_team_spec.rb index 5cd5ae327bf..7b63da005f0 100644 --- a/spec/models/project_team_spec.rb +++ b/spec/models/project_team_spec.rb @@ -68,14 +68,24 @@ describe ProjectTeam, models: true do end describe "#human_max_access" do - it "return master role" do - user = create :user - group = create :group - group.add_users([user.id], GroupMember::MASTER) - project = create(:project, namespace: group) - project.team << [user, :guest] - - expect(project.team.human_max_access(user.id)).to eq("Master") + it 'returns Master role' do + user = create(:user) + group = create(:group) + group.add_master(user) + + project = build_stubbed(:empty_project, namespace: group) + + expect(project.team.human_max_access(user.id)).to eq 'Master' + end + + it 'returns Owner role' do + user = create(:user) + group = create(:group) + group.add_owner(user) + + project = build_stubbed(:empty_project, namespace: group) + + expect(project.team.human_max_access(user.id)).to eq 'Owner' end end end |