summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2012-10-24 14:52:17 +0300
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2012-10-24 14:52:17 +0300
commitb7a9e41bd269e2b5519928c35592aad96d3707c6 (patch)
treefd5677cb16af74ec99a79c07fa5ac660e52c7dfe /spec
parentfd0aca122545bf7e4911f45aaff7bcd960accc7b (diff)
downloadgitlab-ce-b7a9e41bd269e2b5519928c35592aad96d3707c6.tar.gz
Handle perfomance issue with team import. Model specs
Diffstat (limited to 'spec')
-rw-r--r--spec/models/users_project_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/models/users_project_spec.rb b/spec/models/users_project_spec.rb
index 5b6516b32cf..2ad9a0bd909 100644
--- a/spec/models/users_project_spec.rb
+++ b/spec/models/users_project_spec.rb
@@ -35,4 +35,37 @@ describe UsersProject do
it { should respond_to(:user_name) }
it { should respond_to(:user_email) }
end
+
+ describe :import_team do
+ before do
+ @abilities = Six.new
+ @abilities << Ability
+
+ @project_1 = create :project
+ @project_2 = create :project
+
+ @user_1 = create :user
+ @user_2 = create :user
+
+ @project_1.add_access @user_1, :write
+ @project_2.add_access @user_2, :read
+
+ @status = UsersProject.import_team(@project_1, @project_2)
+ end
+
+ it { @status.should be_true }
+
+ describe 'project 2 should get user 1 as developer. user_2 should not be changed' do
+ it { @project_2.users.should include(@user_1) }
+ it { @project_2.users.should include(@user_2) }
+
+ it { @abilities.allowed?(@user_1, :write_project, @project_2).should be_true }
+ it { @abilities.allowed?(@user_2, :read_project, @project_2).should be_true }
+ end
+
+ describe 'project 1 should not be changed' do
+ it { @project_1.users.should include(@user_1) }
+ it { @project_1.users.should_not include(@user_2) }
+ end
+ end
end