diff options
author | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-15 00:52:25 +0100 |
---|---|---|
committer | Riyad Preukschas <riyad@informatik.uni-bremen.de> | 2013-01-15 00:52:25 +0100 |
commit | 30227869482bbbdbfea153f2b45ef3bb9a9fd218 (patch) | |
tree | aff64071116447092751770d2896998f62d1b44a /spec/requests | |
parent | 8ee5fce9d64b70d8981896457484fae622d142c9 (diff) | |
parent | aca0caa8cc1a6bd481f87dd810284e69d3747050 (diff) | |
download | gitlab-ce-30227869482bbbdbfea153f2b45ef3bb9a9fd218.tar.gz |
Merge commit 'master' into discussions
Conflicts:
app/assets/stylesheets/sections/notes.scss
app/contexts/notes/load_context.rb
app/models/project.rb
app/observers/note_observer.rb
app/roles/votes.rb
app/views/commit/show.html.haml
app/views/merge_requests/_show.html.haml
app/views/merge_requests/diffs.js.haml
app/views/merge_requests/show.js.haml
app/views/notes/_note.html.haml
features/steps/project/project_merge_requests.rb
spec/models/note_spec.rb
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/admin/admin_users_spec.rb | 6 | ||||
-rw-r--r-- | spec/requests/api/issues_spec.rb | 14 | ||||
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 16 | ||||
-rw-r--r-- | spec/requests/api/milestones_spec.rb | 12 | ||||
-rw-r--r-- | spec/requests/api/notes_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 61 | ||||
-rw-r--r-- | spec/requests/atom/issues_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/gitlab_flavored_markdown_spec.rb | 6 | ||||
-rw-r--r-- | spec/requests/issues_spec.rb | 3 | ||||
-rw-r--r-- | spec/requests/projects_deploy_keys_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/projects_spec.rb | 57 | ||||
-rw-r--r-- | spec/requests/search_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/security/project_access_spec.rb | 12 | ||||
-rw-r--r-- | spec/requests/snippets_spec.rb | 4 |
14 files changed, 74 insertions, 129 deletions
diff --git a/spec/requests/admin/admin_users_spec.rb b/spec/requests/admin/admin_users_spec.rb index ca134c2d4f7..a66e85a34f9 100644 --- a/spec/requests/admin/admin_users_spec.rb +++ b/spec/requests/admin/admin_users_spec.rb @@ -41,7 +41,7 @@ describe "Admin::Users" do end it "should call send mail" do - Notify.should_receive(:new_user_email).and_return(stub(deliver: true)) + Notify.should_receive(:new_user_email) User.observers.enable :user_observer do click_button "Save" @@ -50,9 +50,7 @@ describe "Admin::Users" do it "should send valid email to user with email & password" do User.observers.enable :user_observer do - with_resque do - click_button "Save" - end + click_button "Save" user = User.last email = ActionMailer::Base.deliveries.last email.subject.should have_content("Account was created") diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 1850ecb95cc..781ebab026b 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -4,9 +4,9 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:issue) { create(:issue, author: user, assignee: user, project: project) } - before { project.add_access(user, :read) } + before { project.team << [user, :reporter] } describe "GET /issues" do context "when unauthenticated" do @@ -28,7 +28,7 @@ describe Gitlab::API do describe "GET /projects/:id/issues" do it "should return project issues" do - get api("/projects/#{project.path}/issues", user) + get api("/projects/#{project.id}/issues", user) response.status.should == 200 json_response.should be_an Array json_response.first['title'].should == issue.title @@ -37,7 +37,7 @@ describe Gitlab::API do describe "GET /projects/:id/issues/:issue_id" do it "should return a project issue by id" do - get api("/projects/#{project.path}/issues/#{issue.id}", user) + get api("/projects/#{project.id}/issues/#{issue.id}", user) response.status.should == 200 json_response['title'].should == issue.title end @@ -45,7 +45,7 @@ describe Gitlab::API do describe "POST /projects/:id/issues" do it "should create a new project issue" do - post api("/projects/#{project.path}/issues", user), + post api("/projects/#{project.id}/issues", user), title: 'new issue', labels: 'label, label2' response.status.should == 201 json_response['title'].should == 'new issue' @@ -56,7 +56,7 @@ describe Gitlab::API do describe "PUT /projects/:id/issues/:issue_id" do it "should update a project issue" do - put api("/projects/#{project.path}/issues/#{issue.id}", user), + put api("/projects/#{project.id}/issues/#{issue.id}", user), title: 'updated title', labels: 'label2', closed: 1 response.status.should == 200 json_response['title'].should == 'updated title' @@ -67,7 +67,7 @@ describe Gitlab::API do describe "DELETE /projects/:id/issues/:issue_id" do it "should delete a project issue" do - delete api("/projects/#{project.path}/issues/#{issue.id}", user) + delete api("/projects/#{project.id}/issues/#{issue.id}", user) response.status.should == 405 end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 43931aedcda..5da54154a81 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -4,21 +4,21 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user ) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:merge_request) { create(:merge_request, author: user, assignee: user, project: project, title: "Test") } - before { project.add_access(user, :read) } + before { project.team << [user, :reporters] } describe "GET /projects/:id/merge_requests" do context "when unauthenticated" do it "should return authentication error" do - get api("/projects/#{project.path}/merge_requests") + get api("/projects/#{project.id}/merge_requests") response.status.should == 401 end end context "when authenticated" do it "should return an array of merge_requests" do - get api("/projects/#{project.path}/merge_requests", user) + get api("/projects/#{project.id}/merge_requests", user) response.status.should == 200 json_response.should be_an Array json_response.first['title'].should == merge_request.title @@ -28,7 +28,7 @@ describe Gitlab::API do describe "GET /projects/:id/merge_request/:merge_request_id" do it "should return merge_request" do - get api("/projects/#{project.path}/merge_request/#{merge_request.id}", user) + get api("/projects/#{project.id}/merge_request/#{merge_request.id}", user) response.status.should == 200 json_response['title'].should == merge_request.title end @@ -36,7 +36,7 @@ describe Gitlab::API do describe "POST /projects/:id/merge_requests" do it "should return merge_request" do - post api("/projects/#{project.path}/merge_requests", user), + post api("/projects/#{project.id}/merge_requests", user), title: 'Test merge_request', source_branch: "stable", target_branch: "master", author: user response.status.should == 201 json_response['title'].should == 'Test merge_request' @@ -45,7 +45,7 @@ describe Gitlab::API do describe "PUT /projects/:id/merge_request/:merge_request_id" do it "should return merge_request" do - put api("/projects/#{project.path}/merge_request/#{merge_request.id}", user), title: "New title" + put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), title: "New title" response.status.should == 200 json_response['title'].should == 'New title' end @@ -53,7 +53,7 @@ describe Gitlab::API do describe "POST /projects/:id/merge_request/:merge_request_id/comments" do it "should return comment" do - post api("/projects/#{project.path}/merge_request/#{merge_request.id}/comments", user), note: "My comment" + post api("/projects/#{project.id}/merge_request/#{merge_request.id}/comments", user), note: "My comment" response.status.should == 201 json_response['note'].should == 'My comment' end diff --git a/spec/requests/api/milestones_spec.rb b/spec/requests/api/milestones_spec.rb index dc96d46d894..80696671462 100644 --- a/spec/requests/api/milestones_spec.rb +++ b/spec/requests/api/milestones_spec.rb @@ -4,14 +4,14 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:milestone) { create(:milestone, project: project) } - before { project.add_access(user, :read) } + before { project.team << [user, :developer] } describe "GET /projects/:id/milestones" do it "should return project milestones" do - get api("/projects/#{project.path}/milestones", user) + get api("/projects/#{project.id}/milestones", user) response.status.should == 200 json_response.should be_an Array json_response.first['title'].should == milestone.title @@ -20,7 +20,7 @@ describe Gitlab::API do describe "GET /projects/:id/milestones/:milestone_id" do it "should return a project milestone by id" do - get api("/projects/#{project.path}/milestones/#{milestone.id}", user) + get api("/projects/#{project.id}/milestones/#{milestone.id}", user) response.status.should == 200 json_response['title'].should == milestone.title end @@ -28,7 +28,7 @@ describe Gitlab::API do describe "POST /projects/:id/milestones" do it "should create a new project milestone" do - post api("/projects/#{project.path}/milestones", user), + post api("/projects/#{project.id}/milestones", user), title: 'new milestone' response.status.should == 201 json_response['title'].should == 'new milestone' @@ -38,7 +38,7 @@ describe Gitlab::API do describe "PUT /projects/:id/milestones/:milestone_id" do it "should update a project milestone" do - put api("/projects/#{project.path}/milestones/#{milestone.id}", user), + put api("/projects/#{project.id}/milestones/#{milestone.id}", user), title: 'updated title' response.status.should == 200 json_response['title'].should == 'updated title' diff --git a/spec/requests/api/notes_spec.rb b/spec/requests/api/notes_spec.rb index 681ba01558e..ae4fc111f63 100644 --- a/spec/requests/api/notes_spec.rb +++ b/spec/requests/api/notes_spec.rb @@ -4,13 +4,13 @@ describe Gitlab::API do include ApiHelpers let(:user) { create(:user) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:issue) { create(:issue, project: project, author: user) } let!(:snippet) { create(:snippet, project: project, author: user) } let!(:issue_note) { create(:note, noteable: issue, project: project, author: user) } let!(:snippet_note) { create(:note, noteable: snippet, project: project, author: user) } let!(:wall_note) { create(:note, project: project, author: user) } - before { project.add_access(user, :read) } + before { project.team << [user, :reporter] } describe "GET /projects/:id/notes" do context "when unauthenticated" do diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index a396516438d..c2244210bcf 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -7,11 +7,11 @@ describe Gitlab::API do let(:user2) { create(:user) } let(:user3) { create(:user) } let!(:hook) { create(:project_hook, project: project, url: "http://example.com") } - let!(:project) { create(:project, owner: user ) } + let!(:project) { create(:project, namespace: user.namespace ) } let!(:snippet) { create(:snippet, author: user, project: project, title: 'example') } let!(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) } let!(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) } - before { project.add_access(user, :read) } + before { project.team << [user, :reporter] } describe "GET /projects" do context "when unauthenticated" do @@ -64,6 +64,7 @@ describe Gitlab::API do post api("/projects", user), project project.each_pair do |k,v| + next if k == :path json_response[k.to_s].should == v end end @@ -78,7 +79,7 @@ describe Gitlab::API do end it "should return a project by path name" do - get api("/projects/#{project.path}", user) + get api("/projects/#{project.id}", user) response.status.should == 200 json_response['name'].should == project.name end @@ -92,7 +93,7 @@ describe Gitlab::API do describe "GET /projects/:id/repository/branches" do it "should return an array of project branches" do - get api("/projects/#{project.path}/repository/branches", user) + get api("/projects/#{project.id}/repository/branches", user) response.status.should == 200 json_response.should be_an Array json_response.first['name'].should == project.repo.heads.sort_by(&:name).first.name @@ -101,7 +102,7 @@ describe Gitlab::API do describe "GET /projects/:id/repository/branches/:branch" do it "should return the branch information for a single branch" do - get api("/projects/#{project.path}/repository/branches/new_design", user) + get api("/projects/#{project.id}/repository/branches/new_design", user) response.status.should == 200 json_response['name'].should == 'new_design' @@ -111,7 +112,7 @@ describe Gitlab::API do describe "GET /projects/:id/members" do it "should return project team members" do - get api("/projects/#{project.path}/members", user) + get api("/projects/#{project.id}/members", user) response.status.should == 200 json_response.should be_an Array json_response.count.should == 2 @@ -119,7 +120,7 @@ describe Gitlab::API do end it "finds team members with query string" do - get api("/projects/#{project.path}/members", user), query: user.username + get api("/projects/#{project.id}/members", user), query: user.username response.status.should == 200 json_response.should be_an Array json_response.count.should == 1 @@ -129,7 +130,7 @@ describe Gitlab::API do describe "GET /projects/:id/members/:user_id" do it "should return project team member" do - get api("/projects/#{project.path}/members/#{user.id}", user) + get api("/projects/#{project.id}/members/#{user.id}", user) response.status.should == 200 json_response['email'].should == user.email json_response['access_level'].should == UsersProject::MASTER @@ -139,7 +140,7 @@ describe Gitlab::API do describe "POST /projects/:id/members" do it "should add user to project team" do expect { - post api("/projects/#{project.path}/members", user), user_id: user2.id, + post api("/projects/#{project.id}/members", user), user_id: user2.id, access_level: UsersProject::DEVELOPER }.to change { UsersProject.count }.by(1) @@ -151,7 +152,7 @@ describe Gitlab::API do describe "PUT /projects/:id/members/:user_id" do it "should update project team member" do - put api("/projects/#{project.path}/members/#{user3.id}", user), access_level: UsersProject::MASTER + put api("/projects/#{project.id}/members/#{user3.id}", user), access_level: UsersProject::MASTER response.status.should == 200 json_response['email'].should == user3.email json_response['access_level'].should == UsersProject::MASTER @@ -161,14 +162,14 @@ describe Gitlab::API do describe "DELETE /projects/:id/members/:user_id" do it "should remove user from project team" do expect { - delete api("/projects/#{project.path}/members/#{user3.id}", user) + delete api("/projects/#{project.id}/members/#{user3.id}", user) }.to change { UsersProject.count }.by(-1) end end describe "GET /projects/:id/hooks" do it "should return project hooks" do - get api("/projects/#{project.path}/hooks", user) + get api("/projects/#{project.id}/hooks", user) response.status.should == 200 @@ -180,7 +181,7 @@ describe Gitlab::API do describe "GET /projects/:id/hooks/:hook_id" do it "should return a project hook" do - get api("/projects/#{project.path}/hooks/#{hook.id}", user) + get api("/projects/#{project.id}/hooks/#{hook.id}", user) response.status.should == 200 json_response['url'].should == hook.url end @@ -189,7 +190,7 @@ describe Gitlab::API do describe "POST /projects/:id/hooks" do it "should add hook to project" do expect { - post api("/projects/#{project.path}/hooks", user), + post api("/projects/#{project.id}/hooks", user), "url" => "http://example.com" }.to change {project.hooks.count}.by(1) end @@ -197,7 +198,7 @@ describe Gitlab::API do describe "PUT /projects/:id/hooks/:hook_id" do it "should update an existing project hook" do - put api("/projects/#{project.path}/hooks/#{hook.id}", user), + put api("/projects/#{project.id}/hooks/#{hook.id}", user), url: 'http://example.org' response.status.should == 200 json_response['url'].should == 'http://example.org' @@ -208,7 +209,7 @@ describe Gitlab::API do describe "DELETE /projects/:id/hooks" do it "should delete hook from project" do expect { - delete api("/projects/#{project.path}/hooks", user), + delete api("/projects/#{project.id}/hooks", user), hook_id: hook.id }.to change {project.hooks.count}.by(-1) end @@ -216,7 +217,7 @@ describe Gitlab::API do describe "GET /projects/:id/repository/tags" do it "should return an array of project tags" do - get api("/projects/#{project.path}/repository/tags", user) + get api("/projects/#{project.id}/repository/tags", user) response.status.should == 200 json_response.should be_an Array json_response.first['name'].should == project.repo.tags.sort_by(&:name).reverse.first.name @@ -225,20 +226,20 @@ describe Gitlab::API do describe "GET /projects/:id/repository/commits" do context "authorized user" do - before { project.add_access(user2, :read) } + before { project.team << [user2, :reporter] } it "should return project commits" do - get api("/projects/#{project.path}/repository/commits", user) + get api("/projects/#{project.id}/repository/commits", user) response.status.should == 200 json_response.should be_an Array - json_response.first['id'].should == project.commit.id + json_response.first['id'].should == project.repository.commit.id end end context "unauthorized user" do it "should not return project commits" do - get api("/projects/#{project.path}/repository/commits") + get api("/projects/#{project.id}/repository/commits") response.status.should == 401 end end @@ -246,7 +247,7 @@ describe Gitlab::API do describe "GET /projects/:id/snippets" do it "should return an array of project snippets" do - get api("/projects/#{project.path}/snippets", user) + get api("/projects/#{project.id}/snippets", user) response.status.should == 200 json_response.should be_an Array json_response.first['title'].should == snippet.title @@ -255,7 +256,7 @@ describe Gitlab::API do describe "GET /projects/:id/snippets/:snippet_id" do it "should return a project snippet" do - get api("/projects/#{project.path}/snippets/#{snippet.id}", user) + get api("/projects/#{project.id}/snippets/#{snippet.id}", user) response.status.should == 200 json_response['title'].should == snippet.title end @@ -263,7 +264,7 @@ describe Gitlab::API do describe "POST /projects/:id/snippets" do it "should create a new project snippet" do - post api("/projects/#{project.path}/snippets", user), + post api("/projects/#{project.id}/snippets", user), title: 'api test', file_name: 'sample.rb', code: 'test' response.status.should == 201 json_response['title'].should == 'api test' @@ -272,7 +273,7 @@ describe Gitlab::API do describe "PUT /projects/:id/snippets/:shippet_id" do it "should update an existing project snippet" do - put api("/projects/#{project.path}/snippets/#{snippet.id}", user), + put api("/projects/#{project.id}/snippets/#{snippet.id}", user), code: 'updated code' response.status.should == 200 json_response['title'].should == 'example' @@ -283,31 +284,31 @@ describe Gitlab::API do describe "DELETE /projects/:id/snippets/:snippet_id" do it "should delete existing project snippet" do expect { - delete api("/projects/#{project.path}/snippets/#{snippet.id}", user) + delete api("/projects/#{project.id}/snippets/#{snippet.id}", user) }.to change { Snippet.count }.by(-1) end end describe "GET /projects/:id/snippets/:snippet_id/raw" do it "should get a raw project snippet" do - get api("/projects/#{project.path}/snippets/#{snippet.id}/raw", user) + get api("/projects/#{project.id}/snippets/#{snippet.id}/raw", user) response.status.should == 200 end end describe "GET /projects/:id/:sha/blob" do it "should get the raw file contents" do - get api("/projects/#{project.path}/repository/commits/master/blob?filepath=README.md", user) + get api("/projects/#{project.id}/repository/commits/master/blob?filepath=README.md", user) response.status.should == 200 end it "should return 404 for invalid branch_name" do - get api("/projects/#{project.path}/repository/commits/invalid_branch_name/blob?filepath=README.md", user) + get api("/projects/#{project.id}/repository/commits/invalid_branch_name/blob?filepath=README.md", user) response.status.should == 404 end it "should return 404 for invalid file" do - get api("/projects/#{project.path}/repository/commits/master/blob?filepath=README.invalid", user) + get api("/projects/#{project.id}/repository/commits/master/blob?filepath=README.invalid", user) response.status.should == 404 end end diff --git a/spec/requests/atom/issues_spec.rb b/spec/requests/atom/issues_spec.rb index 29f88f3f1c3..0488c1f2266 100644 --- a/spec/requests/atom/issues_spec.rb +++ b/spec/requests/atom/issues_spec.rb @@ -3,10 +3,10 @@ require 'spec_helper' describe "Issues Feed" do describe "GET /issues" do let!(:user) { create(:user) } - let!(:project) { create(:project, owner: user) } + let!(:project) { create(:project, namespace: user.namespace) } let!(:issue) { create(:issue, author: user, project: project) } - before { project.add_access(user, :read, :write) } + before { project.team << [user, :developer] } context "when authenticated" do it "should render atom feed" do diff --git a/spec/requests/gitlab_flavored_markdown_spec.rb b/spec/requests/gitlab_flavored_markdown_spec.rb index 7f61c6aaa73..78b8c0c513f 100644 --- a/spec/requests/gitlab_flavored_markdown_spec.rb +++ b/spec/requests/gitlab_flavored_markdown_spec.rb @@ -6,7 +6,7 @@ describe "Gitlab Flavored Markdown" do let(:merge_request) { create(:merge_request, project: project) } let(:fred) do u = create(:user, name: "fred") - project.add_access(u, :admin) + project.team << [u, :master] u end @@ -33,11 +33,11 @@ describe "Gitlab Flavored Markdown" do project.repo.gc_auto end - let(:commit) { project.commits(@branch_name).first } + let(:commit) { project.repository.commits(@branch_name).first } before do login_as :user - project.add_access(@user, :read, :write) + project.team << [@user, :developer] end describe "for commits" do diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index 0814108523b..2e94ffd0020 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -7,8 +7,7 @@ describe "Issues" do login_as :user user2 = create(:user) - project.add_access(@user, :read, :write) - project.add_access(user2, :read, :write) + project.team << [[@user, user2], :developer] end describe "Edit issue" do diff --git a/spec/requests/projects_deploy_keys_spec.rb b/spec/requests/projects_deploy_keys_spec.rb index 35323f556f9..25b1da9ebd8 100644 --- a/spec/requests/projects_deploy_keys_spec.rb +++ b/spec/requests/projects_deploy_keys_spec.rb @@ -5,7 +5,7 @@ describe "Projects", "DeployKeys" do before do login_as :user - project.add_access(@user, :read, :write, :admin) + project.team << [@user, :master] end describe "GET /keys" do diff --git a/spec/requests/projects_spec.rb b/spec/requests/projects_spec.rb index e097f0805fc..7bc48260935 100644 --- a/spec/requests/projects_spec.rb +++ b/spec/requests/projects_spec.rb @@ -3,63 +3,10 @@ require 'spec_helper' describe "Projects" do before { login_as :user } - describe "GET /projects/show" do - before do - @project = create(:project, owner: @user) - @project.add_access(@user, :read) - - visit project_path(@project) - end - - it "should be correct path" do - current_path.should == project_path(@project) - end - end - - describe "GET /projects/:id/edit" do - before do - @project = create(:project) - @project.add_access(@user, :admin, :read) - - visit edit_project_path(@project) - end - - it "should be correct path" do - current_path.should == edit_project_path(@project) - end - - it "should have labels for new project" do - page.should have_content("Project name is") - page.should have_content("Advanced settings:") - page.should have_content("Features:") - end - end - - describe "PUT /projects/:id" do - before do - @project = create(:project, owner: @user) - @project.add_access(@user, :admin, :read) - - visit edit_project_path(@project) - - fill_in 'project_name', with: 'Awesome' - click_button "Save" - @project = @project.reload - end - - it "should be correct path" do - current_path.should == edit_project_path(@project) - end - - it "should show project" do - page.should have_content("Awesome") - end - end - describe "DELETE /projects/:id" do before do - @project = create(:project, owner: @user) - @project.add_access(@user, :read, :admin) + @project = create(:project, namespace: @user.namespace) + @project.team << [@user, :master] visit edit_project_path(@project) end diff --git a/spec/requests/search_spec.rb b/spec/requests/search_spec.rb index 17cc0d39946..e338f359f88 100644 --- a/spec/requests/search_spec.rb +++ b/spec/requests/search_spec.rb @@ -4,7 +4,7 @@ describe "Search" do before do login_as :user @project = create(:project) - @project.add_access(@user, :read) + @project.team << [@user, :reporter] visit search_path fill_in "search", with: @project.name[0..3] click_button "Search" diff --git a/spec/requests/security/project_access_spec.rb b/spec/requests/security/project_access_spec.rb index 060a276b740..a35175102ec 100644 --- a/spec/requests/security/project_access_spec.rb +++ b/spec/requests/security/project_access_spec.rb @@ -22,10 +22,10 @@ describe "Application access" do before do # full access - project.users_projects.create(user: master, project_access: UsersProject::MASTER) + project.team << [master, :master] # readonly - project.users_projects.create(user: reporter, project_access: UsersProject::REPORTER) + project.team << [reporter, :reporter] end describe "GET /project_code" do @@ -40,7 +40,7 @@ describe "Application access" do end describe "GET /project_code/tree/master" do - subject { project_tree_path(project, project.root_ref) } + subject { project_tree_path(project, project.repository.root_ref) } it { should be_allowed_for master } it { should be_allowed_for reporter } @@ -51,7 +51,7 @@ describe "Application access" do end describe "GET /project_code/commits/master" do - subject { project_commits_path(project, project.root_ref, limit: 1) } + subject { project_commits_path(project, project.repository.root_ref, limit: 1) } it { should be_allowed_for master } it { should be_allowed_for reporter } @@ -62,7 +62,7 @@ describe "Application access" do end describe "GET /project_code/commit/:sha" do - subject { project_commit_path(project, project.commit) } + subject { project_commit_path(project, project.repository.commit) } it { should be_allowed_for master } it { should be_allowed_for reporter } @@ -107,7 +107,7 @@ describe "Application access" do describe "GET /project_code/blob" do before do - commit = project.commit + commit = project.repository.commit path = commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name @blob_path = project_blob_path(project, File.join(commit.id, path)) end diff --git a/spec/requests/snippets_spec.rb b/spec/requests/snippets_spec.rb index b231b940a84..770e34dc07c 100644 --- a/spec/requests/snippets_spec.rb +++ b/spec/requests/snippets_spec.rb @@ -5,7 +5,7 @@ describe "Snippets" do before do login_as :user - project.add_access(@user, :read, :write) + project.team << [@user, :developer] end describe "GET /snippets" do @@ -26,7 +26,7 @@ describe "Snippets" do before do # admin access to remove snippet @user.users_projects.destroy_all - project.add_access(@user, :read, :write, :admin) + project.team << [@user, :master] visit edit_project_snippet_path(project, @snippet) end |