summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-12-07 10:04:57 +0200
committerDmitriy Zaporozhets <dzaporozhets@sphereconsultinginc.com>2011-12-07 10:04:57 +0200
commit1b8f082061e3f120ab02b263cb68e3433b028ef6 (patch)
tree8c4dd949e79b9b04f0d53e3b17f13b06ae2d6385 /spec
parent68154e8fe9d6266f3b1ae00e48530143f87cd138 (diff)
downloadgitlab-ce-1b8f082061e3f120ab02b263cb68e3433b028ef6.tar.gz
new access rights implemented
Diffstat (limited to 'spec')
-rw-r--r--spec/models/note_spec.rb18
-rw-r--r--spec/requests/team_members_spec.rb26
2 files changed, 16 insertions, 28 deletions
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index bd3f3934aec..ce7488dbb8d 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -31,9 +31,9 @@ describe Note do
describe :read do
before do
- @p1.users_projects.create(:user => @u1, :read => false)
- @p1.users_projects.create(:user => @u2, :read => true)
- @p2.users_projects.create(:user => @u3, :read => true)
+ @p1.users_projects.create(:user => @u1, :project_access => Project::PROJECT_N)
+ @p1.users_projects.create(:user => @u2, :project_access => Project::PROJECT_R)
+ @p2.users_projects.create(:user => @u3, :project_access => Project::PROJECT_R)
end
it { @abilities.allowed?(@u1, :read_note, @p1).should be_false }
@@ -43,9 +43,9 @@ describe Note do
describe :write do
before do
- @p1.users_projects.create(:user => @u1, :write => false)
- @p1.users_projects.create(:user => @u2, :write => true)
- @p2.users_projects.create(:user => @u3, :write => true)
+ @p1.users_projects.create(:user => @u1, :project_access => Project::PROJECT_R)
+ @p1.users_projects.create(:user => @u2, :project_access => Project::PROJECT_RW)
+ @p2.users_projects.create(:user => @u3, :project_access => Project::PROJECT_RW)
end
it { @abilities.allowed?(@u1, :write_note, @p1).should be_false }
@@ -55,9 +55,9 @@ describe Note do
describe :admin do
before do
- @p1.users_projects.create(:user => @u1, :admin => false)
- @p1.users_projects.create(:user => @u2, :admin => true)
- @p2.users_projects.create(:user => @u3, :admin => true)
+ @p1.users_projects.create(:user => @u1, :project_access => Project::PROJECT_R)
+ @p1.users_projects.create(:user => @u2, :project_access => Project::PROJECT_RWA)
+ @p2.users_projects.create(:user => @u3, :project_access => Project::PROJECT_RWA)
end
it { @abilities.allowed?(@u1, :admin_note, @p1).should be_false }
diff --git a/spec/requests/team_members_spec.rb b/spec/requests/team_members_spec.rb
index 3178cd2afaa..c15ef19c724 100644
--- a/spec/requests/team_members_spec.rb
+++ b/spec/requests/team_members_spec.rb
@@ -32,11 +32,10 @@ describe "TeamMembers" do
describe "fill in" do
before do
page.execute_script("$('#team_member_user_id').show();")
- select @user_1.name, :from => "team_member_user_id"
-
- within "#team_member_new" do
- check "team_member_read"
- check "team_member_write"
+ within "#team_member_new" do
+ select @user_1.name, :from => "team_member_user_id"
+ select "Report", :from => "team_member_project_access"
+ select "Pull", :from => "team_member_repo_access"
end
end
@@ -48,20 +47,9 @@ describe "TeamMembers" do
page.should have_content @user_1.name
- @member.read.should be_true
- @member.write.should be_true
- @member.admin.should be_false
- end
-
- it "should not allow creation without access selected" do
- within "#team_member_new" do
- uncheck "team_member_read"
- uncheck "team_member_write"
- uncheck "team_member_admin"
- end
-
- expect { click_button "Save" }.to_not change {UsersProject.count}
- page.should have_content("Please choose at least one Role in the Access list")
+ @member.reload
+ @member.project_access.should == Project::PROJECT_RW
+ @member.repo_access.should == Repository::REPO_R
end
end
end