+++ /dev/null
-require 'spec_helper'
-
-describe Gitlab::UserTeamManager do
- before do
- @user = create :user
- @project = create :project, creator: @user
-
- @master = create :user
- @developer = create :user
- @reporter = create :user
-
- @project.team << [@master, :master]
- @project.team << [@developer, :developer]
- @project.team << [@reporter, :reporter]
-
- @team = create :user_team, owner: @user
-
- @team.add_members([@master.id, @developer.id, @reporter.id], UsersProject::DEVELOPER, false)
- end
-
- it "should assign team to project with correct permissions result" do
- @team.assign_to_project(@project, UsersProject::MASTER)
-
- @project.users_projects.find_by_user_id(@master).project_access.should == UsersProject::MASTER
- @project.users_projects.find_by_user_id(@developer).project_access.should == UsersProject::DEVELOPER
- @project.users_projects.find_by_user_id(@reporter).project_access.should == UsersProject::DEVELOPER
- end
-end
it { @user.owned_groups.should == [@group] }
end
- describe 'teams' do
- before do
- ActiveRecord::Base.observers.enable(:user_observer)
- @admin = create :user, admin: true
- @user1 = create :user
- @user2 = create :user
- @team = create :user_team, owner: @user1
- end
-
- it { @admin.authorized_teams.should == [@team] }
- it { @user1.authorized_teams.should == [@team] }
- it { @user2.authorized_teams.should be_empty }
- it { @admin.should be_can(:manage_user_team, @team) }
- it { @user1.should be_can(:manage_user_team, @team) }
- it { @user2.should_not be_can(:manage_user_team, @team) }
- end
-
describe 'namespaced' do
before do
ActiveRecord::Base.observers.enable(:user_observer)