diff options
author | babatakao <babatakao@gmail.com> | 2013-06-04 18:50:51 +0400 |
---|---|---|
committer | baba <baba@bpsinc.jp> | 2013-06-04 21:59:30 +0400 |
commit | 37a90d5f764231cd765ff38448c6d650e61a4012 (patch) | |
tree | a40b7b6388822aee46ca36e6c126cce20a0d378c /spec/models/user_spec.rb | |
parent | b9d989dc056a2a2b9316ff9aa06b57c736426871 (diff) |
Selectable deploy keys contain master projects
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 9673854da53..f0a6012d0c2 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -106,11 +106,33 @@ describe User do ActiveRecord::Base.observers.enable(:user_observer) @user = create :user @project = create :project, namespace: @user.namespace + @project_2 = create :project # Grant MASTER access to the user + @project_3 = create :project # Grant DEVELOPER access to the user + + UsersProject.add_users_into_projects( + [@project_2.id], [@user.id], UsersProject::MASTER + ) + UsersProject.add_users_into_projects( + [@project_3.id], [@user.id], UsersProject::DEVELOPER + ) end it { @user.authorized_projects.should include(@project) } + it { @user.authorized_projects.should include(@project_2) } + it { @user.authorized_projects.should include(@project_3) } it { @user.owned_projects.should include(@project) } + it { @user.owned_projects.should_not include(@project_2) } + it { @user.owned_projects.should_not include(@project_3) } it { @user.personal_projects.should include(@project) } + it { @user.personal_projects.should_not include(@project_2) } + it { @user.personal_projects.should_not include(@project_3) } + + # master_projects doesn't check creator/namespace. + # In real case the users_projects relation will certainly be assigned + # when the project is created. + it { @user.master_projects.should_not include(@project) } + it { @user.master_projects.should include(@project_2) } + it { @user.master_projects.should_not include(@project_3) } end describe 'groups' do |