diff options
Diffstat (limited to 'spec/models/project_team_spec.rb')
-rw-r--r-- | spec/models/project_team_spec.rb | 26 |
1 files changed, 18 insertions, 8 deletions
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 |