summaryrefslogtreecommitdiff
path: root/spec/models/project_team_spec.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2016-11-18 14:52:39 +0200
committerRobert Speicher <rspeicher@gmail.com>2016-11-18 14:55:04 +0200
commiteef360912320ecfcb427684edf35672b643a87c0 (patch)
treede26c28e81a3fa72d0427cc19079205cca00d6c5 /spec/models/project_team_spec.rb
parent688ff26df3f288e5cd50096a01014188a5e4011b (diff)
downloadgitlab-ce-eef360912320ecfcb427684edf35672b643a87c0.tar.gz
Add shortcuts for adding users to a project team with a specific rolers-project-team-helpers
This also updates _some_ specs to use these new methods, just to serve as an example for others going forward, but by no means is this exhaustive. Original implementations at !5992 and !6012. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/20944
Diffstat (limited to 'spec/models/project_team_spec.rb')
-rw-r--r--spec/models/project_team_spec.rb34
1 files changed, 17 insertions, 17 deletions
diff --git a/spec/models/project_team_spec.rb b/spec/models/project_team_spec.rb
index 12228425579..eb6b009c7cf 100644
--- a/spec/models/project_team_spec.rb
+++ b/spec/models/project_team_spec.rb
@@ -10,9 +10,9 @@ describe ProjectTeam, models: true do
let(:project) { create(:empty_project) }
before do
- project.team << [master, :master]
- project.team << [reporter, :reporter]
- project.team << [guest, :guest]
+ project.add_master(master)
+ project.add_reporter(reporter)
+ project.add_guest(guest)
end
describe 'members collection' do
@@ -47,8 +47,8 @@ describe ProjectTeam, models: true do
# If user is a group and a project member - GitLab uses highest permission
# So we add group guest as master and add group master as guest
# to this project to test highest access
- project.team << [guest, :master]
- project.team << [master, :guest]
+ project.add_master(guest)
+ project.add_guest(master)
end
describe 'members collection' do
@@ -79,14 +79,14 @@ describe ProjectTeam, models: true do
it 'returns project members' do
user = create(:user)
- project.team << [user, :guest]
+ project.add_guest(user)
expect(project.team.members).to contain_exactly(user)
end
it 'returns project members of a specified level' do
user = create(:user)
- project.team << [user, :reporter]
+ project.add_reporter(user)
expect(project.team.guests).to be_empty
expect(project.team.reporters).to contain_exactly(user)
@@ -141,9 +141,9 @@ describe ProjectTeam, models: true do
let(:requester) { create(:user) }
before do
- project.team << [master, :master]
- project.team << [reporter, :reporter]
- project.team << [guest, :guest]
+ project.add_master(master)
+ project.add_reporter(reporter)
+ project.add_guest(guest)
project.request_access(requester)
end
@@ -204,9 +204,9 @@ describe ProjectTeam, models: true do
context 'when project is not shared with group' do
before do
- project.team << [master, :master]
- project.team << [reporter, :reporter]
- project.team << [guest, :guest]
+ project.add_master(master)
+ project.add_reporter(reporter)
+ project.add_guest(guest)
project.request_access(requester)
end
@@ -281,10 +281,10 @@ describe ProjectTeam, models: true do
guest = create(:user)
project = create(:project)
- project.team << [master, :master]
- project.team << [reporter, :reporter]
- project.team << [promoted_guest, :guest]
- project.team << [guest, :guest]
+ project.add_master(master)
+ project.add_reporter(reporter)
+ project.add_guest(promoted_guest)
+ project.add_guest(guest)
group = create(:group)
group_developer = create(:user)