diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-23 17:55:01 -0600 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-23 17:55:01 -0600 |
commit | ad640bc5f92ef0456a53dd82004f449cd9d7475d (patch) | |
tree | 0da24fad5572f7fe272c15d842f9b1dfe89e7487 | |
parent | 509ff2ab170802e23646282f1d146a6383b53a66 (diff) | |
download | gitlab-ce-ad640bc5f92ef0456a53dd82004f449cd9d7475d.tar.gz |
Use Namespace#full_path instead of #path where appropriatedm-more-namespace-full-path
68 files changed, 344 insertions, 349 deletions
diff --git a/app/assets/javascripts/milestone_select.js b/app/assets/javascripts/milestone_select.js index 8df1c8e7f94..51fa5c828b3 100644 --- a/app/assets/javascripts/milestone_select.js +++ b/app/assets/javascripts/milestone_select.js @@ -39,7 +39,7 @@ $value = $block.find('.value'); $loading = $block.find('.block-loading').fadeOut(); if (issueUpdateURL) { - milestoneLinkTemplate = _.template('<a href="/<%- namespace %>/<%- path %>/milestones/<%- iid %>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>'); + milestoneLinkTemplate = _.template('<a href="/<%- full_path %>/milestones/<%- iid %>" class="bold has-tooltip" data-container="body" title="<%- remaining %>"><%- title %></a>'); milestoneLinkNoneTemplate = '<span class="no-value">None</span>'; collapsedSidebarLabelTemplate = _.template('<span class="has-tooltip" data-container="body" title="<%- remaining %>" data-placement="left"> <%- title %> </span>'); } @@ -181,8 +181,7 @@ $selectbox.hide(); $value.css('display', ''); if (data.milestone != null) { - data.milestone.namespace = _this.currentProject.namespace; - data.milestone.path = _this.currentProject.path; + data.milestone.full_path = _this.currentProject.full_path; data.milestone.remaining = gl.utils.timeFor(data.milestone.due_date); $value.html(milestoneLinkTemplate(data.milestone)); return $sidebarCollapsedValue.find('span').html(collapsedSidebarLabelTemplate(data.milestone)); diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 715072290c6..860a665ae26 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -52,7 +52,7 @@ module IssuablesHelper field_name: 'issuable_template', selected: selected_template(issuable), project_path: ref_project.path, - namespace_path: ref_project.namespace.path + namespace_path: ref_project.namespace.full_path } } diff --git a/app/models/project.rb b/app/models/project.rb index 301ff71cc01..765784de9e6 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -360,7 +360,7 @@ class Project < ActiveRecord::Base end def reference_pattern - name_pattern = Gitlab::Regex::NAMESPACE_REGEX_STR + name_pattern = Gitlab::Regex::FULL_NAMESPACE_REGEX_STR %r{ ((?<namespace>#{name_pattern})\/)? @@ -848,10 +848,6 @@ class Project < ActiveRecord::Base gitlab_shell.url_to_repo(path_with_namespace) end - def namespace_dir - namespace.try(:path) || '' - end - def repo_exists? @repo_exists ||= repository.exists? rescue @@ -900,8 +896,8 @@ class Project < ActiveRecord::Base def rename_repo path_was = previous_changes['path'].first - old_path_with_namespace = File.join(namespace_dir, path_was) - new_path_with_namespace = File.join(namespace_dir, path) + old_path_with_namespace = File.join(namespace.full_path, path_was) + new_path_with_namespace = File.join(namespace.full_path, path) Rails.logger.error "Attempting to rename #{old_path_with_namespace} -> #{new_path_with_namespace}" diff --git a/app/models/user.rb b/app/models/user.rb index fada0e567f0..f0905cc305b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -334,7 +334,7 @@ class User < ActiveRecord::Base def reference_pattern %r{ #{Regexp.escape(reference_prefix)} - (?<user>#{Gitlab::Regex::NAMESPACE_REF_REGEX_STR}) + (?<user>#{Gitlab::Regex::FULL_NAMESPACE_REGEX_STR}) }x end end diff --git a/app/views/devise/shared/_signup_box.html.haml b/app/views/devise/shared/_signup_box.html.haml index 5a44ec45b7b..30e63d991bb 100644 --- a/app/views/devise/shared/_signup_box.html.haml +++ b/app/views/devise/shared/_signup_box.html.haml @@ -8,7 +8,7 @@ = f.text_field :name, class: "form-control top", required: true, title: "This field is required." .username.form-group = f.label :username - = f.text_field :username, class: "form-control middle", pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_SIMPLE, required: true, title: 'Please create a username with only alphanumeric characters.' + = f.text_field :username, class: "form-control middle", pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_JS, required: true, title: 'Please create a username with only alphanumeric characters.' %p.validation-error.hide Username is already taken. %p.validation-success.hide Username is available. %p.validation-pending.hide Checking username availability... diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml index b9300efd04f..83ae9fd10ec 100644 --- a/app/views/projects/edit.html.haml +++ b/app/views/projects/edit.html.haml @@ -120,7 +120,7 @@ .form-group - if @project.avatar? .avatar-container.s160 - = project_icon("#{@project.namespace.to_param}/#{@project.to_param}", alt: '', class: 'avatar project-avatar s160') + = project_icon(@project.full_path, alt: '', class: 'avatar project-avatar s160') %p.light - if @project.avatar_in_git Project avatar in repository: #{ @project.avatar_in_git } diff --git a/app/views/shared/_group_form.html.haml b/app/views/shared/_group_form.html.haml index efb207b9916..02b7b2447ed 100644 --- a/app/views/shared/_group_form.html.haml +++ b/app/views/shared/_group_form.html.haml @@ -17,7 +17,7 @@ %strong= parent.full_path + '/' = f.text_field :path, placeholder: 'open-source', class: 'form-control', autofocus: local_assigns[:autofocus] || false, required: true, - pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_SIMPLE, + pattern: Gitlab::Regex::NAMESPACE_REGEX_STR_JS, title: 'Please choose a group name with no special characters.' - if parent = f.hidden_field :parent_id, value: parent.id diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml index 3f7f1a86b9f..6c730e16f67 100644 --- a/app/views/shared/issuable/_sidebar.html.haml +++ b/app/views/shared/issuable/_sidebar.html.haml @@ -173,7 +173,7 @@ :javascript gl.IssuableResource = new gl.SubbableResource('#{issuable_json_path(issuable)}'); new gl.IssuableTimeTracking("#{escape_javascript(serialize_issuable(issuable))}"); - new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}'); + new MilestoneSelect('{"full_path":"#{@project.full_path}"}'); new LabelsSelect(); new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}'); gl.Subscription.bindAll('.subscription'); diff --git a/lib/gitlab/import_export.rb b/lib/gitlab/import_export.rb index f1d1af8eee5..8b327cfc226 100644 --- a/lib/gitlab/import_export.rb +++ b/lib/gitlab/import_export.rb @@ -35,7 +35,7 @@ module Gitlab end def export_filename(project:) - basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.namespace.full_path}_#{project.path}" + basename = "#{Time.now.strftime('%Y-%m-%d_%H-%M-%3N')}_#{project.full_path.tr('/', '_')}" "#{basename[0..FILENAME_LIMIT]}_export.tar.gz" end diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index c77fe2d8bdc..5e5f5ff1589 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -5,17 +5,18 @@ module Gitlab # The namespace regex is used in Javascript to validate usernames in the "Register" form. However, Javascript # does not support the negative lookbehind assertion (?<!) that disallows usernames ending in `.git` and `.atom`. # Since this is a non-trivial problem to solve in Javascript (heavily complicate the regex, modify view code to - # allow non-regex validatiions, etc), `NAMESPACE_REGEX_STR_SIMPLE` serves as a Javascript-compatible version of + # allow non-regex validatiions, etc), `NAMESPACE_REGEX_STR_JS` serves as a Javascript-compatible version of # `NAMESPACE_REGEX_STR`, with the negative lookbehind assertion removed. This means that the client-side validation # will pass for usernames ending in `.atom` and `.git`, but will be caught by the server-side validation. PATH_REGEX_STR = '[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*'.freeze - NAMESPACE_REGEX_STR_SIMPLE = PATH_REGEX_STR + '[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'.freeze - NAMESPACE_REGEX_STR = '(?:' + NAMESPACE_REGEX_STR_SIMPLE + ')(?<!\.git|\.atom)'.freeze - PROJECT_REGEX_STR = PATH_REGEX_STR + '(?<!\.git|\.atom)'.freeze + NAMESPACE_REGEX_STR_JS = PATH_REGEX_STR + '[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'.freeze + NO_SUFFIX_REGEX_STR = '(?<!\.git|\.atom)'.freeze + NAMESPACE_REGEX_STR = "(?:#{NAMESPACE_REGEX_STR_JS})#{NO_SUFFIX_REGEX_STR}".freeze + PROJECT_REGEX_STR = "(?:#{PATH_REGEX_STR})#{NO_SUFFIX_REGEX_STR}".freeze # Same as NAMESPACE_REGEX_STR but allows `/` in the path. # So `group/subgroup` will match this regex but not NAMESPACE_REGEX_STR - NAMESPACE_REF_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.\/]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])(?<!\.git|\.atom)'.freeze + FULL_NAMESPACE_REGEX_STR = "(?:#{NAMESPACE_REGEX_STR}/)*#{NAMESPACE_REGEX_STR}".freeze def namespace_regex @namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze diff --git a/spec/controllers/blob_controller_spec.rb b/spec/controllers/blob_controller_spec.rb index 2fcb4a6a528..44e011fd3a8 100644 --- a/spec/controllers/blob_controller_spec.rb +++ b/spec/controllers/blob_controller_spec.rb @@ -19,8 +19,8 @@ describe Projects::BlobController do before do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: id) end @@ -50,8 +50,8 @@ describe Projects::BlobController do before do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: id) controller.instance_variable_set(:@blob, nil) end diff --git a/spec/controllers/projects/blame_controller_spec.rb b/spec/controllers/projects/blame_controller_spec.rb index addc5e7ec33..c086b386381 100644 --- a/spec/controllers/projects/blame_controller_spec.rb +++ b/spec/controllers/projects/blame_controller_spec.rb @@ -16,8 +16,8 @@ describe Projects::BlameController do before do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: id) end diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index 7d4636e98d1..ec36a64b415 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -14,8 +14,8 @@ describe Projects::BlobController do render_views def do_get(opts = {}) - params = { namespace_id: project.namespace.to_param, - project_id: project.to_param, + params = { namespace_id: project.namespace, + project_id: project, id: 'master/CHANGELOG' } get :diff, params.merge(opts) end @@ -40,8 +40,8 @@ describe Projects::BlobController do describe 'PUT update' do let(:default_params) do { - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: 'master/CHANGELOG', target_branch: 'master', content: 'Added changes', @@ -96,8 +96,8 @@ describe Projects::BlobController do context 'when editing on the fork' do before do - default_params[:namespace_id] = forked_project.namespace.to_param - default_params[:project_id] = forked_project.to_param + default_params[:namespace_id] = forked_project.namespace + default_params[:project_id] = forked_project end it 'redirects to blob' do diff --git a/spec/controllers/projects/boards/issues_controller_spec.rb b/spec/controllers/projects/boards/issues_controller_spec.rb index ad15e3942a5..3d0533cb516 100644 --- a/spec/controllers/projects/boards/issues_controller_spec.rb +++ b/spec/controllers/projects/boards/issues_controller_spec.rb @@ -90,7 +90,7 @@ describe Projects::Boards::IssuesController do params = { namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, board_id: board.to_param, list_id: list.try(:to_param) } @@ -146,7 +146,7 @@ describe Projects::Boards::IssuesController do sign_in(user) post :create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, board_id: board.to_param, list_id: list.to_param, issue: { title: title }, @@ -209,7 +209,7 @@ describe Projects::Boards::IssuesController do sign_in(user) patch :update, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, board_id: board.to_param, id: issue.to_param, from_list_id: from_list_id, diff --git a/spec/controllers/projects/boards/lists_controller_spec.rb b/spec/controllers/projects/boards/lists_controller_spec.rb index b3f9f76a50c..432f3c53c90 100644 --- a/spec/controllers/projects/boards/lists_controller_spec.rb +++ b/spec/controllers/projects/boards/lists_controller_spec.rb @@ -47,7 +47,7 @@ describe Projects::Boards::ListsController do sign_in(user) get :index, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, board_id: board.to_param, format: :json end @@ -104,7 +104,7 @@ describe Projects::Boards::ListsController do sign_in(user) post :create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, board_id: board.to_param, list: { label_id: label_id }, format: :json @@ -157,7 +157,7 @@ describe Projects::Boards::ListsController do sign_in(user) patch :update, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, board_id: board.to_param, id: list.to_param, list: { position: position }, @@ -200,7 +200,7 @@ describe Projects::Boards::ListsController do sign_in(user) delete :destroy, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, board_id: board.to_param, id: list.to_param, format: :json @@ -244,7 +244,7 @@ describe Projects::Boards::ListsController do sign_in(user) post :generate, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, board_id: board.to_param, format: :json end diff --git a/spec/controllers/projects/boards_controller_spec.rb b/spec/controllers/projects/boards_controller_spec.rb index cc19035740e..aed3a45c413 100644 --- a/spec/controllers/projects/boards_controller_spec.rb +++ b/spec/controllers/projects/boards_controller_spec.rb @@ -50,8 +50,8 @@ describe Projects::BoardsController do end def list_boards(format: :html) - get :index, namespace_id: project.namespace.to_param, - project_id: project.to_param, + get :index, namespace_id: project.namespace, + project_id: project, format: format end end @@ -100,8 +100,8 @@ describe Projects::BoardsController do end def read_board(board:, format: :html) - get :show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + get :show, namespace_id: project.namespace, + project_id: project, id: board.to_param, format: format end diff --git a/spec/controllers/projects/branches_controller_spec.rb b/spec/controllers/projects/branches_controller_spec.rb index 9de03876755..21aa9a79b31 100644 --- a/spec/controllers/projects/branches_controller_spec.rb +++ b/spec/controllers/projects/branches_controller_spec.rb @@ -22,8 +22,8 @@ describe Projects::BranchesController do sign_in(user) post :create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, branch_name: branch, ref: ref end @@ -76,8 +76,8 @@ describe Projects::BranchesController do it 'redirects' do post :create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, branch_name: branch, issue_iid: issue.iid @@ -89,8 +89,8 @@ describe Projects::BranchesController do expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch") post :create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, branch_name: branch, issue_iid: issue.iid end @@ -106,8 +106,8 @@ describe Projects::BranchesController do expect(SystemNoteService).not_to receive(:new_issue_branch) post :create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, branch_name: branch, issue_iid: issue.iid end @@ -126,8 +126,8 @@ describe Projects::BranchesController do post :destroy, format: :html, id: 'foo/bar/baz', - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project expect(response).to have_http_status(303) end @@ -142,8 +142,8 @@ describe Projects::BranchesController do post :destroy, format: :js, id: branch, - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project end context "valid branch name, valid source" do @@ -173,8 +173,8 @@ describe Projects::BranchesController do describe "DELETE destroy_all_merged" do def destroy_all_merged delete :destroy_all_merged, - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project end context 'when user is allowed to push' do diff --git a/spec/controllers/projects/commit_controller_spec.rb b/spec/controllers/projects/commit_controller_spec.rb index ebd2d0e092b..640baa3a01c 100644 --- a/spec/controllers/projects/commit_controller_spec.rb +++ b/spec/controllers/projects/commit_controller_spec.rb @@ -17,8 +17,8 @@ describe Projects::CommitController do def go(extra_params = {}) params = { - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project } get :show, params.merge(extra_params) @@ -125,8 +125,8 @@ describe Projects::CommitController do it 'renders it' do get(:show, - namespace_id: fork_project.namespace.to_param, - project_id: fork_project.to_param, + namespace_id: fork_project.namespace, + project_id: fork_project, id: commit.id) expect(response).to be_success @@ -139,8 +139,8 @@ describe Projects::CommitController do commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e') get(:branches, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: commit.id) expect(assigns(:branches)).to include("master", "feature_conflict") @@ -152,8 +152,8 @@ describe Projects::CommitController do context 'when target branch is not provided' do it 'renders the 404 page' do post(:revert, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: commit.id) expect(response).not_to be_success @@ -164,8 +164,8 @@ describe Projects::CommitController do context 'when the revert was successful' do it 'redirects to the commits page' do post(:revert, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, target_branch: 'master', id: commit.id) @@ -177,8 +177,8 @@ describe Projects::CommitController do context 'when the revert failed' do before do post(:revert, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, target_branch: 'master', id: commit.id) end @@ -186,8 +186,8 @@ describe Projects::CommitController do it 'redirects to the commit page' do # Reverting a commit that has been already reverted. post(:revert, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, target_branch: 'master', id: commit.id) @@ -201,8 +201,8 @@ describe Projects::CommitController do context 'when target branch is not provided' do it 'renders the 404 page' do post(:cherry_pick, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: master_pickable_commit.id) expect(response).not_to be_success @@ -213,8 +213,8 @@ describe Projects::CommitController do context 'when the cherry-pick was successful' do it 'redirects to the commits page' do post(:cherry_pick, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, target_branch: 'master', id: master_pickable_commit.id) @@ -226,8 +226,8 @@ describe Projects::CommitController do context 'when the cherry_pick failed' do before do post(:cherry_pick, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, target_branch: 'master', id: master_pickable_commit.id) end @@ -235,8 +235,8 @@ describe Projects::CommitController do it 'redirects to the commit page' do # Cherry-picking a commit that has been already cherry-picked. post(:cherry_pick, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, target_branch: 'master', id: master_pickable_commit.id) @@ -249,8 +249,8 @@ describe Projects::CommitController do describe 'GET diff_for_path' do def diff_for_path(extra_params = {}) params = { - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project } get :diff_for_path, params.merge(extra_params) @@ -313,8 +313,8 @@ describe Projects::CommitController do describe 'GET pipelines' do def get_pipelines(extra_params = {}) params = { - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project } get :pipelines, params.merge(extra_params) diff --git a/spec/controllers/projects/commits_controller_spec.rb b/spec/controllers/projects/commits_controller_spec.rb index 54b8d1108a5..e26731fb691 100644 --- a/spec/controllers/projects/commits_controller_spec.rb +++ b/spec/controllers/projects/commits_controller_spec.rb @@ -16,8 +16,8 @@ describe Projects::CommitsController do context "when the ref does not exist with the suffix" do it "renders as atom" do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: "master.atom") expect(response).to be_success @@ -33,8 +33,8 @@ describe Projects::CommitsController do allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit) get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: "master.atom") end diff --git a/spec/controllers/projects/compare_controller_spec.rb b/spec/controllers/projects/compare_controller_spec.rb index e811c76fb31..15ac4e0925a 100644 --- a/spec/controllers/projects/compare_controller_spec.rb +++ b/spec/controllers/projects/compare_controller_spec.rb @@ -13,8 +13,8 @@ describe Projects::CompareController do it 'compare shows some diffs' do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, from: ref_from, to: ref_to) @@ -25,8 +25,8 @@ describe Projects::CompareController do it 'compare shows some diffs with ignore whitespace change option' do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, from: '08f22f25', to: '66eceea0', w: 1) @@ -43,8 +43,8 @@ describe Projects::CompareController do describe 'non-existent refs' do it 'uses invalid source ref' do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, from: 'non-existent', to: ref_to) @@ -55,8 +55,8 @@ describe Projects::CompareController do it 'uses invalid target ref' do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, from: ref_from, to: 'non-existent') @@ -67,8 +67,8 @@ describe Projects::CompareController do it 'redirects back to index when params[:from] is empty and preserves params[:to]' do post(:create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, from: '', to: 'master') @@ -77,8 +77,8 @@ describe Projects::CompareController do it 'redirects back to index when params[:to] is empty and preserves params[:from]' do post(:create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, from: 'master', to: '') @@ -87,8 +87,8 @@ describe Projects::CompareController do it 'redirects back to index when params[:from] and params[:to] are empty' do post(:create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, from: '', to: '') @@ -99,8 +99,8 @@ describe Projects::CompareController do describe 'GET diff_for_path' do def diff_for_path(extra_params = {}) params = { - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project } get :diff_for_path, params.merge(extra_params) diff --git a/spec/controllers/projects/cycle_analytics_controller_spec.rb b/spec/controllers/projects/cycle_analytics_controller_spec.rb index 6a6d71a16ee..6fae52edbad 100644 --- a/spec/controllers/projects/cycle_analytics_controller_spec.rb +++ b/spec/controllers/projects/cycle_analytics_controller_spec.rb @@ -13,8 +13,8 @@ describe Projects::CycleAnalyticsController do context 'with no data' do it 'is true' do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param) + namespace_id: project.namespace, + project_id: project) expect(response).to be_success expect(assigns(:cycle_analytics_no_data)).to eq(true) @@ -32,8 +32,8 @@ describe Projects::CycleAnalyticsController do it 'is false' do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param) + namespace_id: project.namespace, + project_id: project) expect(response).to be_success expect(assigns(:cycle_analytics_no_data)).to eq(false) diff --git a/spec/controllers/projects/find_file_controller_spec.rb b/spec/controllers/projects/find_file_controller_spec.rb index a4884256c92..6a5433bcc9c 100644 --- a/spec/controllers/projects/find_file_controller_spec.rb +++ b/spec/controllers/projects/find_file_controller_spec.rb @@ -17,8 +17,8 @@ describe Projects::FindFileController do before do get(:show, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: id) end @@ -36,8 +36,8 @@ describe Projects::FindFileController do describe "GET #list" do def go(format: 'json') get :list, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, id: id, format: format end diff --git a/spec/controllers/projects/forks_controller_spec.rb b/spec/controllers/projects/forks_controller_spec.rb index a867668d97b..8282d79298f 100644 --- a/spec/controllers/projects/forks_controller_spec.rb +++ b/spec/controllers/projects/forks_controller_spec.rb @@ -9,8 +9,8 @@ describe Projects::ForksController do describe 'GET index' do def get_forks get :index, - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project end context 'when fork is public' do @@ -71,8 +71,8 @@ describe Projects::ForksController do describe 'GET new' do def get_new get :new, - namespace_id: project.namespace.to_param, - project_id: project.to_param + namespace_id: project.namespace, + project_id: project end context 'when user is signed in' do @@ -99,8 +99,8 @@ describe Projects::ForksController do describe 'POST create' do def post_create post :create, - namespace_id: project.namespace.to_param, - project_id: project.to_param, + namespace_id: project.namespace, + project_id: project, namespace_key: user.namespace.id end diff --git a/spec/controllers/projects/graphs_controller_spec.rb b/spec/controllers/projects/graphs_controller_spec.rb index bbe8e4bf6b2..c4a7aa7d63e 100644 --- a/spec/controllers/projects/graphs_controller_spec.rb +++ b/spec/controllers/projects/graphs_controller_spec.rb @@ -34,7 +34,7 @@ describe Projects::GraphsController do end it 'sets the correct colour according to language' do - get(:languages, namespace_id: project.namespace.path, project_id: project.path, id: 'master') + get(:languages, namespace_id: project.namespace, project_id: project, id: 'master') expected_values.each do |val| expect(assigns(:languages)).to include(a_hash_including(val)) diff --git a/spec/controllers/projects/group_links_controller_spec.rb b/spec/controllers/projects/group_links_controller_spec.rb index a976a9c27ab..ca4a8e871c0 100644 --- a/spec/controllers/projects/group_links_controller_spec.rb +++ b/spec/controllers/projects/group_links_controller_spec.rb @@ -14,8 +14,8 @@ describe Projects::GroupLinksController do describe '#create' do shared_context 'link project to group' do before do - post(:create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + post(:create, namespace_id: project.namespace, + project_id: project, link_group_id: group.id, link_group_access: ProjectGroupLink.default_access) end @@ -50,8 +50,8 @@ describe Projects::GroupLinksController do context 'when project group id equal link group id' do before do - post(:create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + post(:create, namespace_id: project.namespace, + project_id: project, link_group_id: group2.id, link_group_access: ProjectGroupLink.default_access) end @@ -69,8 +69,8 @@ describe Projects::GroupLinksController do context 'when link group id is not present' do before do - post(:create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + post(:create, namespace_id: project.namespace, + project_id: project, link_group_access: ProjectGroupLink.default_access) end diff --git a/spec/controllers/projects/imports_controller_spec.rb b/spec/controllers/projects/imports_controller_spec.rb index 2acbba469e3..7c75815f3c4 100644 --- a/spec/controllers/projects/imports_controller_spec.rb +++ b/spec/controllers/projects/imports_controller_spec.rb @@ -13,13 +13,13 @@ describe Projects::ImportsController do end it 'renders template' do - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param + get :show, namespace_id: project.namespace.to_param, project_id: project expect(response).to render_template :show end it 'sets flash.now if params is present' do - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { to: '/', notice_now: 'Started' } + get :show, namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'Started' } expect(flash.now[:notice]).to eq 'Started' end @@ -39,13 +39,13 @@ describe Projects::ImportsController do end it 'renders template' do - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param + get :show, namespace_id: project.namespace.to_param, project_id: project expect(response).to render_template :show end it 'sets flash.now if params is present' do - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: { to: '/', notice_now: 'In progress' } + get :show, namespace_id: project.namespace.to_param, project_id: project, continue: { to: '/', notice_now: 'In progress' } expect(flash.now[:notice]).to eq 'In progress' end @@ -57,7 +57,7 @@ describe Projects::ImportsController do end it 'redirects to new_namespace_project_import_path' do - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param + get :show, namespace_id: project.namespace.to_param, project_id: project expect(response).to redirect_to new_namespace_project_import_path(project.namespace, project) end @@ -72,7 +72,7 @@ describe Projects::ImportsController do it 'redirects to namespace_project_path' do allow_any_instance_of(Project).to receive(:forked?).and_return(true) - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param + get :show, namespace_id: project.namespace.to_param, project_id: project expect(flash[:notice]).to eq 'The project was successfully forked.' expect(response).to redirect_to namespace_project_path(project.namespace, project) @@ -81,7 +81,7 @@ describe Projects::ImportsController do context 'when project is external' do it 'redirects to namespace_project_path' do - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param + get :show, namespace_id: project.namespace.to_param, project_id: project expect(flash[:notice]).to eq 'The project was successfully imported.' expect(response).to redirect_to namespace_project_path(project.namespace, project) @@ -97,7 +97,7 @@ describe Projects::ImportsController do end it 'redirects to params[:to]' do - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, continue: params + get :show, namespace_id: project.namespace.to_param, project_id: project, continue: params expect(flash[:notice]).to eq params[:notice] expect(response).to redirect_to params[:to] @@ -111,7 +111,7 @@ describe Projects::ImportsController do end it 'redirects to namespace_project_path' do - get :show, namespace_id: project.namespace.to_param, project_id: project.to_param + get :show, namespace_id: project.namespace.to_param, project_id: project expect(response).to redirect_to namespace_project_path(project.namespace, project) end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 7871b6a9e10..e493b9396f6 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -12,7 +12,7 @@ describe Projects::IssuesController do allow(project).to receive(:external_issue_tracker).and_return(external) controller.instance_variable_set(:@project, project) - get :index, namespace_id: project.namespace.path, project_id: project + get :index, namespace_id: project.namespace, project_id: project expect(response).to redirect_to('https://example.com/project') end @@ -27,13 +27,13 @@ describe Projects::IssuesController do it_behaves_like "issuables list meta-data", :issue it "returns index" do - get :index, namespace_id: project.namespace.path, project_id: project.path + get :index, namespace_id: project.namespace, project_id: project expect(response).to have_http_status(200) end it "returns 301 if request path doesn't match project path" do - get :index, namespace_id: project.namespace.path, project_id: project.path.upcase + get :index, namespace_id: project.namespace, project_id: project.path.upcase expect(response).to redirect_to(namespace_project_issues_path(project.namespace, project)) end @@ -42,7 +42,7 @@ describe Projects::IssuesController do project.issues_enabled = false project.save - get :index, namespace_id: project.namespace.path, project_id: project.path + get :index, namespace_id: project.namespace, project_id: project expect(response).to have_http_status(404) end @@ -50,7 +50,7 @@ describe Projects::IssuesController do controller.instance_variable_set(:@project, project) allow(project).to receive(:default_issues_tracker?).and_return(false) - get :index, namespace_id: project.namespace.path, project_id: project.path + get :index, namespace_id: project.namespace, project_id: project expect(response).to have_http_status(404) end end @@ -67,8 +67,8 @@ describe Projects::IssuesController do it 'redirects to last_page if page number is larger than number of pages' do get :index, - namespace_id: project.namespace.path.to_param, - project_id: project.path.to_param, + namespace_id: project.namespace.to_param, + project_id: project, page: (last_page + 1).to_param expect(response).to redirect_to(namespace_project_issues_path(page: last_page, state: controller.params[:state], scope: controller.params[:scope])) @@ -76,8 +76,8 @@ describe Projects::IssuesController do it 'redirects to specified page' do get :index, - namespace_id: project.namespace.path.to_param, - project_id: project.path.to_param, + namespace_id: project.namespace.to_param, + project_id: project, page: last_page.to_param expect(assigns(:issues).current_page).to eq(last_page) @@ -94,7 +94,7 @@ describe Projects::IssuesController do end it 'builds a new issue' do - get :new, namespace_id: project.namespace.path, project_id: project + get :new, namespace_id: project.namespace, project_id: project expect(assigns(:issue)).to be_a_new(Issue) end @@ -104,7 +104,7 @@ describe Projects::IssuesController do project_with_repository.team << [user, :developer] mr = create(:merge_request_with_diff_notes, source_project: project_with_repository) - get :new, namespace_id: project_with_repository.namespace.path, project_id: project_with_repository, merge_request_for_resolving_discussions: mr.iid + get :new, namespace_id: project_with_repository.namespace, project_id: project_with_repository, merge_request_for_resolving_discussions: mr.iid expect(assigns(:issue).title).not_to be_empty expect(assigns(:issue).description).not_to be_empty @@ -117,7 +117,7 @@ describe Projects::IssuesController do allow(project).to receive(:external_issue_tracker).and_return(external) controller.instance_variable_set(:@project, project) - get :new, namespace_id: project.namespace.path, project_id: project + get :new, namespace_id: project.namespace, project_id: project expect(response).to redirect_to('https://example.com/issues/new') end @@ -251,7 +251,7 @@ describe Projects::IssuesController do def update_issue(issue_params = {}, additional_params = {}) params = { namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: issue.iid, issue: issue_params }.merge(additional_params) @@ -262,7 +262,7 @@ describe Projects::IssuesController do def move_issue put :update, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: issue.iid, issue: { title: 'New title' }, move_to_project_id: another_project.id @@ -342,7 +342,7 @@ describe Projects::IssuesController do def get_issues get :index, namespace_id: project.namespace.to_param, - project_id: project.to_param + project_id: project end end @@ -405,7 +405,7 @@ describe Projects::IssuesController do def go(id:) get :show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: id end end @@ -416,7 +416,7 @@ describe Projects::IssuesController do def go(id:) get :edit, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: id end end @@ -427,7 +427,7 @@ describe Projects::IssuesController do def go(id:) put :update, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: id, issue: { title: 'New title' } end @@ -442,7 +442,7 @@ describe Projects::IssuesController do post :create, { namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, issue: { title: 'Title', description: 'Description' }.merge(issue_attrs) }.merge(additional_params) @@ -464,7 +464,7 @@ describe Projects::IssuesController do end def post_issue(issue_params) - post :create, namespace_id: project.namespace.to_param, project_id: project.to_param, issue: issue_params, merge_request_for_resolving_discussions: merge_request.iid + post :create, namespace_id: project.namespace.to_param, project_id: project, issue: issue_params, merge_request_for_resolving_discussions: merge_request.iid end it 'creates an issue for the project' do @@ -607,8 +607,8 @@ describe Projects::IssuesController do project.team << [admin, :master] sign_in(admin) post :mark_as_spam, { - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, id: issue.iid } end @@ -624,7 +624,7 @@ describe Projects::IssuesController do context "when the user is a developer" do before { sign_in(user) } it "rejects a developer to destroy an issue" do - delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: issue.iid + delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid expect(response).to have_http_status(404) end end @@ -637,7 +637,7 @@ describe Projects::IssuesController do before { sign_in(owner) } it "deletes the issue" do - delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: issue.iid + delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid expect(response).to have_http_status(302) expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./).now @@ -646,7 +646,7 @@ describe Projects::IssuesController do it 'delegates the update of the todos count cache to TodoService' do expect_any_instance_of(TodoService).to receive(:destroy_issue).with(issue, owner).once - delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: issue.iid + delete :destroy, namespace_id: project.namespace, project_id: project, id: issue.iid end end end @@ -659,8 +659,8 @@ describe Projects::IssuesController do it "toggles the award emoji" do expect do - post(:toggle_award_emoji, namespace_id: project.namespace.path, - project_id: project.path, id: issue.iid, name: "thumbsup") + post(:toggle_award_emoji, namespace_id: project.namespace, + project_id: project, id: issue.iid, name: "thumbsup") end.to change { issue.award_emoji.count }.by(1) expect(response).to have_http_status(200) diff --git a/spec/controllers/projects/labels_controller_spec.rb b/spec/controllers/projects/labels_controller_spec.rb index 3e0326dd47d..6a6e9bf378a 100644 --- a/spec/controllers/projects/labels_controller_spec.rb +++ b/spec/controllers/projects/labels_controller_spec.rb @@ -67,7 +67,7 @@ describe Projects::LabelsController do end def list_labels - get :index, namespace_id: project.namespace.to_param, project_id: project.to_param + get :index, namespace_id: project.namespace.to_param, project_id: project end end @@ -76,7 +76,7 @@ describe Projects::LabelsController do let(:personal_project) { create(:empty_project, namespace: user.namespace) } it 'creates labels' do - post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project.to_param + post :generate, namespace_id: personal_project.namespace.to_param, project_id: personal_project expect(response).to have_http_status(302) end @@ -84,7 +84,7 @@ describe Projects::LabelsController do context 'project belonging to a group' do it 'creates labels' do - post :generate, namespace_id: project.namespace.to_param, project_id: project.to_param + post :generate, namespace_id: project.namespace.to_param, project_id: project expect(response).to have_http_status(302) end @@ -109,7 +109,7 @@ describe Projects::LabelsController do end def toggle_subscription(label) - post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label.to_param + post :toggle_subscription, namespace_id: project.namespace.to_param, project_id: project, id: label.to_param end end @@ -119,7 +119,7 @@ describe Projects::LabelsController do context 'not group owner' do it 'denies access' do - post :promote, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label_1.to_param + post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param expect(response).to have_http_status(404) end @@ -131,13 +131,13 @@ describe Projects::LabelsController do end it 'gives access' do - post :promote, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label_1.to_param + post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param expect(response).to redirect_to(namespace_project_labels_path) end it 'promotes the label' do - post :promote, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label_1.to_param + post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param expect(Label.where(id: label_1.id)).to be_empty expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil @@ -151,7 +151,7 @@ describe Projects::LabelsController do end it 'returns to label list' do - post :promote, namespace_id: project.namespace.to_param, project_id: project.to_param, id: label_1.to_param + post :promote, namespace_id: project.namespace.to_param, project_id: project, id: label_1.to_param expect(response).to redirect_to(namespace_project_labels_path) end end diff --git a/spec/controllers/projects/mattermosts_controller_spec.rb b/spec/controllers/projects/mattermosts_controller_spec.rb index cae733f0cfb..c5abf11cfa5 100644 --- a/spec/controllers/projects/mattermosts_controller_spec.rb +++ b/spec/controllers/projects/mattermosts_controller_spec.rb @@ -18,7 +18,7 @@ describe Projects::MattermostsController do it 'accepts the request' do get(:new, namespace_id: project.namespace.to_param, - project_id: project.to_param) + project_id: project) expect(response).to have_http_status(200) end @@ -30,7 +30,7 @@ describe Projects::MattermostsController do subject do post(:create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, mattermost: mattermost_params) end diff --git a/spec/controllers/projects/merge_requests_controller_spec.rb b/spec/controllers/projects/merge_requests_controller_spec.rb index af13649eec5..d9cb429132f 100644 --- a/spec/controllers/projects/merge_requests_controller_spec.rb +++ b/spec/controllers/projects/merge_requests_controller_spec.rb @@ -51,7 +51,7 @@ describe Projects::MergeRequestsController do def submit_new_merge_request(format: :html) get :new, namespace_id: fork_project.namespace.to_param, - project_id: fork_project.to_param, + project_id: fork_project, merge_request: { source_branch: 'remove-submodule', target_branch: 'master' @@ -64,7 +64,7 @@ describe Projects::MergeRequestsController do it "loads labels into the @labels variable" do get action, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: 'html' expect(assigns(:labels)).not_to be_nil @@ -76,7 +76,7 @@ describe Projects::MergeRequestsController do it "does generally work" do get(:show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: format) @@ -90,7 +90,7 @@ describe Projects::MergeRequestsController do get(:show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: format) end @@ -98,7 +98,7 @@ describe Projects::MergeRequestsController do it "renders it" do get(:show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: format) @@ -111,7 +111,7 @@ describe Projects::MergeRequestsController do get(:show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: format) @@ -126,7 +126,7 @@ describe Projects::MergeRequestsController do it "triggers workhorse to serve the request" do get(:show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: :diff) @@ -138,7 +138,7 @@ describe Projects::MergeRequestsController do it 'triggers workhorse to serve the request' do get(:show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: :patch) @@ -153,7 +153,7 @@ describe Projects::MergeRequestsController do def get_merge_requests(page = nil) get :index, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, state: 'opened', page: page.to_param end @@ -216,8 +216,8 @@ describe Projects::MergeRequestsController do it 'closes MR without errors' do post :update, - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, id: merge_request.iid, merge_request: { state_event: 'close' @@ -231,8 +231,8 @@ describe Projects::MergeRequestsController do merge_request.close! put :update, - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, id: merge_request.iid, merge_request: { title: 'New title' @@ -246,8 +246,8 @@ describe Projects::MergeRequestsController do merge_request.close! put :update, - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, id: merge_request.iid, merge_request: { target_branch: 'new_branch' @@ -261,8 +261,8 @@ describe Projects::MergeRequestsController do describe 'POST merge' do let(:base_params) do { - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, id: merge_request.iid, format: 'raw' } @@ -426,7 +426,7 @@ describe Projects::MergeRequestsController do describe "DELETE destroy" do it "denies access to users unless they're admin or project owner" do - delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: merge_request.iid + delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid expect(response).to have_http_status(404) end @@ -439,7 +439,7 @@ describe Projects::MergeRequestsController do before { sign_in owner } it "deletes the merge request" do - delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: merge_request.iid + delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid expect(response).to have_http_status(302) expect(controller).to set_flash[:notice].to(/The merge request was successfully deleted\./).now @@ -448,7 +448,7 @@ describe Projects::MergeRequestsController do it 'delegates the update of the todos count cache to TodoService' do expect_any_instance_of(TodoService).to receive(:destroy_merge_request).with(merge_request, owner).once - delete :destroy, namespace_id: project.namespace.path, project_id: project.path, id: merge_request.iid + delete :destroy, namespace_id: project.namespace, project_id: project, id: merge_request.iid end end end @@ -457,7 +457,7 @@ describe Projects::MergeRequestsController do def go(extra_params = {}) params = { namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid } @@ -537,7 +537,7 @@ describe Projects::MergeRequestsController do def diff_for_path(extra_params = {}) params = { namespace_id: project.namespace.to_param, - project_id: project.to_param + project_id: project } get :diff_for_path, params.merge(extra_params) @@ -601,7 +601,7 @@ describe Projects::MergeRequestsController do before do other_project.team << [user, :master] - diff_for_path(id: merge_request.iid, old_path: existing_path, new_path: existing_path, project_id: other_project.to_param) + diff_for_path(id: merge_request.iid, old_path: existing_path, new_path: existing_path, project_id: other_project) end it 'returns a 404' do @@ -667,7 +667,7 @@ describe Projects::MergeRequestsController do def go(format: 'html') get :commits, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: format end @@ -707,7 +707,7 @@ describe Projects::MergeRequestsController do before do get :pipelines, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid, format: :json end @@ -726,7 +726,7 @@ describe Projects::MergeRequestsController do get :conflicts, namespace_id: merge_request_with_conflicts.project.namespace.to_param, - project_id: merge_request_with_conflicts.project.to_param, + project_id: merge_request_with_conflicts.project, id: merge_request_with_conflicts.iid, format: 'json' end @@ -744,7 +744,7 @@ describe Projects::MergeRequestsController do before do get :conflicts, namespace_id: merge_request_with_conflicts.project.namespace.to_param, - project_id: merge_request_with_conflicts.project.to_param, + project_id: merge_request_with_conflicts.project, id: merge_request_with_conflicts.iid, format: 'json' end @@ -807,7 +807,7 @@ describe Projects::MergeRequestsController do post :remove_wip, namespace_id: merge_request.project.namespace.to_param, - project_id: merge_request.project.to_param, + project_id: merge_request.project, id: merge_request.iid expect(merge_request.reload.title).to eq(merge_request.wipless_title) @@ -818,7 +818,7 @@ describe Projects::MergeRequestsController do def conflict_for_path(path) get :conflict_for_path, namespace_id: merge_request_with_conflicts.project.namespace.to_param, - project_id: merge_request_with_conflicts.project.to_param, + project_id: merge_request_with_conflicts.project, id: merge_request_with_conflicts.iid, old_path: path, new_path: path, @@ -874,7 +874,7 @@ describe Projects::MergeRequestsController do def resolve_conflicts(files) post :resolve_conflicts, namespace_id: merge_request_with_conflicts.project.namespace.to_param, - project_id: merge_request_with_conflicts.project.to_param, + project_id: merge_request_with_conflicts.project, id: merge_request_with_conflicts.iid, format: 'json', files: files, @@ -1025,7 +1025,7 @@ describe Projects::MergeRequestsController do post :assign_related_issues, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.iid end @@ -1080,7 +1080,7 @@ describe Projects::MergeRequestsController do get :ci_environments_status, namespace_id: merge_request.project.namespace.to_param, - project_id: merge_request.project.to_param, + project_id: merge_request.project, id: merge_request.iid, format: 'json' end @@ -1093,8 +1093,8 @@ describe Projects::MergeRequestsController do describe 'GET merge_widget_refresh' do let(:params) do { - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, id: merge_request.iid, format: :raw } diff --git a/spec/controllers/projects/pipelines_controller_spec.rb b/spec/controllers/projects/pipelines_controller_spec.rb index 9a1e79c281a..04bb5cbbd59 100644 --- a/spec/controllers/projects/pipelines_controller_spec.rb +++ b/spec/controllers/projects/pipelines_controller_spec.rb @@ -17,8 +17,8 @@ describe Projects::PipelinesController do create(:ci_empty_pipeline, status: 'created', project: project) create(:ci_empty_pipeline, status: 'success', project: project) - get :index, namespace_id: project.namespace.path, - project_id: project.path, + get :index, namespace_id: project.namespace, + project_id: project, format: :json end @@ -62,8 +62,8 @@ describe Projects::PipelinesController do end def get_stage(name) - get :stage, namespace_id: project.namespace.path, - project_id: project.path, + get :stage, namespace_id: project.namespace, + project_id: project, id: pipeline.id, stage: name, format: :json diff --git a/spec/controllers/projects/protected_branches_controller_spec.rb b/spec/controllers/projects/protected_branches_controller_spec.rb index da6112a13f7..e378b5714fe 100644 --- a/spec/controllers/projects/protected_branches_controller_spec.rb +++ b/spec/controllers/projects/protected_branches_controller_spec.rb @@ -4,7 +4,7 @@ describe Projects::ProtectedBranchesController do describe "GET #index" do let(:project) { create(:project_empty_repo, :public) } it "redirects empty repo to projects page" do - get(:index, namespace_id: project.namespace.to_param, project_id: project.to_param) + get(:index, namespace_id: project.namespace.to_param, project_id: project) end end end diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb index b23d6e257ba..4cebe3884bf 100644 --- a/spec/controllers/projects/raw_controller_spec.rb +++ b/spec/controllers/projects/raw_controller_spec.rb @@ -10,7 +10,7 @@ describe Projects::RawController do it 'delivers ASCII file' do get(:show, namespace_id: public_project.namespace.to_param, - project_id: public_project.to_param, + project_id: public_project, id: id) expect(response).to have_http_status(200) @@ -27,7 +27,7 @@ describe Projects::RawController do it 'sets image content type header' do get(:show, namespace_id: public_project.namespace.to_param, - project_id: public_project.to_param, + project_id: public_project, id: id) expect(response).to have_http_status(200) @@ -51,7 +51,7 @@ describe Projects::RawController do expect(controller).to receive(:send_file).with("#{Gitlab.config.shared.path}/lfs-objects/91/ef/f75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897", filename: "lfs_object.iso", disposition: 'attachment') get(:show, namespace_id: public_project.namespace.to_param, - project_id: public_project.to_param, + project_id: public_project, id: id) expect(response).to have_http_status(200) @@ -62,7 +62,7 @@ describe Projects::RawController do it 'does not serve the file' do get(:show, namespace_id: public_project.namespace.to_param, - project_id: public_project.to_param, + project_id: public_project, id: id) expect(response).to have_http_status(404) diff --git a/spec/controllers/projects/refs_controller_spec.rb b/spec/controllers/projects/refs_controller_spec.rb index d8fb4667c67..3a3e7467ef2 100644 --- a/spec/controllers/projects/refs_controller_spec.rb +++ b/spec/controllers/projects/refs_controller_spec.rb @@ -13,7 +13,7 @@ describe Projects::RefsController do def default_get(format = :html) get :logs_tree, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: 'master', path: 'foo/bar/baz.html', format: format @@ -23,7 +23,7 @@ describe Projects::RefsController do xhr :get, :logs_tree, namespace_id: project.namespace.to_param, - project_id: project.to_param, id: 'master', + project_id: project, id: 'master', path: 'foo/bar/baz.html', format: format end diff --git a/spec/controllers/projects/releases_controller_spec.rb b/spec/controllers/projects/releases_controller_spec.rb index 69fcc26c77e..358f26dfb02 100644 --- a/spec/controllers/projects/releases_controller_spec.rb +++ b/spec/controllers/projects/releases_controller_spec.rb @@ -16,7 +16,7 @@ describe Projects::ReleasesController do tag_id = release.tag project.releases.destroy_all - get :edit, namespace_id: project.namespace.path, project_id: project.path, tag_id: tag_id + get :edit, namespace_id: project.namespace, project_id: project, tag_id: tag_id release = assigns(:release) expect(release).not_to be_nil @@ -24,7 +24,7 @@ describe Projects::ReleasesController do end it 'retrieves an existing release' do - get :edit, namespace_id: project.namespace.path, project_id: project.path, tag_id: release.tag + get :edit, namespace_id: project.namespace, project_id: project, tag_id: release.tag release = assigns(:release) expect(release).not_to be_nil @@ -48,7 +48,7 @@ describe Projects::ReleasesController do def update_release(description) put :update, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, tag_id: release.tag, release: { description: description } end diff --git a/spec/controllers/projects/repositories_controller_spec.rb b/spec/controllers/projects/repositories_controller_spec.rb index 04e88879fb8..9c55d159fa0 100644 --- a/spec/controllers/projects/repositories_controller_spec.rb +++ b/spec/controllers/projects/repositories_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::RepositoriesController do describe "GET archive" do context 'as a guest' do it 'responds with redirect in correct format' do - get :archive, namespace_id: project.namespace.path, project_id: project.path, format: "zip" + get :archive, namespace_id: project.namespace, project_id: project, format: "zip" expect(response.header["Content-Type"]).to start_with('text/html') expect(response).to be_redirect @@ -22,7 +22,7 @@ describe Projects::RepositoriesController do end it "uses Gitlab::Workhorse" do - get :archive, namespace_id: project.namespace.path, project_id: project.path, ref: "master", format: "zip" + get :archive, namespace_id: project.namespace, project_id: project, ref: "master", format: "zip" expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:") end @@ -33,7 +33,7 @@ describe Projects::RepositoriesController do end it "renders Not Found" do - get :archive, namespace_id: project.namespace.path, project_id: project.path, ref: "master", format: "zip" + get :archive, namespace_id: project.namespace, project_id: project, ref: "master", format: "zip" expect(response).to have_http_status(404) end diff --git a/spec/controllers/projects/snippets_controller_spec.rb b/spec/controllers/projects/snippets_controller_spec.rb index 8bab094a79e..24a59caff4e 100644 --- a/spec/controllers/projects/snippets_controller_spec.rb +++ b/spec/controllers/projects/snippets_controller_spec.rb @@ -17,16 +17,16 @@ describe Projects::SnippetsController do it 'redirects to last_page if page number is larger than number of pages' do get :index, - namespace_id: project.namespace.path, - project_id: project.path, page: (last_page + 1).to_param + namespace_id: project.namespace, + project_id: project, page: (last_page + 1).to_param expect(response).to redirect_to(namespace_project_snippets_path(page: last_page)) end it 'redirects to specified page' do get :index, - namespace_id: project.namespace.path, - project_id: project.path, page: last_page.to_param + namespace_id: project.namespace, + project_id: project, page: last_page.to_param expect(assigns(:snippets).current_page).to eq(last_page) expect(response).to have_http_status(200) @@ -38,7 +38,7 @@ describe Projects::SnippetsController do context 'when anonymous' do it 'does not include the private snippet' do - get :index, namespace_id: project.namespace.path, project_id: project.path + get :index, namespace_id: project.namespace, project_id: project expect(assigns(:snippets)).not_to include(project_snippet) expect(response).to have_http_status(200) @@ -49,7 +49,7 @@ describe Projects::SnippetsController do before { sign_in(user) } it 'renders the snippet' do - get :index, namespace_id: project.namespace.path, project_id: project.path + get :index, namespace_id: project.namespace, project_id: project expect(assigns(:snippets)).to include(project_snippet) expect(response).to have_http_status(200) @@ -60,7 +60,7 @@ describe Projects::SnippetsController do before { sign_in(user2) } it 'renders the snippet' do - get :index, namespace_id: project.namespace.path, project_id: project.path + get :index, namespace_id: project.namespace, project_id: project expect(assigns(:snippets)).to include(project_snippet) expect(response).to have_http_status(200) @@ -77,7 +77,7 @@ describe Projects::SnippetsController do post :create, { namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params) }.merge(additional_params) end @@ -152,7 +152,7 @@ describe Projects::SnippetsController do put :update, { namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: snippet.id, project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params) }.merge(additional_params) @@ -281,8 +281,8 @@ describe Projects::SnippetsController do sign_in(admin) post :mark_as_spam, - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, id: snippet.id end @@ -300,7 +300,7 @@ describe Projects::SnippetsController do context 'when anonymous' do it 'responds with status 404' do - get action, namespace_id: project.namespace.path, project_id: project.path, id: project_snippet.to_param + get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param expect(response).to have_http_status(404) end @@ -310,7 +310,7 @@ describe Projects::SnippetsController do before { sign_in(user) } it 'renders the snippet' do - get action, namespace_id: project.namespace.path, project_id: project.path, id: project_snippet.to_param + get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param expect(assigns(:snippet)).to eq(project_snippet) expect(response).to have_http_status(200) @@ -321,7 +321,7 @@ describe Projects::SnippetsController do before { sign_in(user2) } it 'renders the snippet' do - get action, namespace_id: project.namespace.path, project_id: project.path, id: project_snippet.to_param + get action, namespace_id: project.namespace, project_id: project, id: project_snippet.to_param expect(assigns(:snippet)).to eq(project_snippet) expect(response).to have_http_status(200) @@ -332,7 +332,7 @@ describe Projects::SnippetsController do context 'when the project snippet does not exist' do context 'when anonymous' do it 'responds with status 404' do - get action, namespace_id: project.namespace.path, project_id: project.path, id: 42 + get action, namespace_id: project.namespace, project_id: project, id: 42 expect(response).to have_http_status(404) end @@ -342,7 +342,7 @@ describe Projects::SnippetsController do before { sign_in(user) } it 'responds with status 404' do - get action, namespace_id: project.namespace.path, project_id: project.path, id: 42 + get action, namespace_id: project.namespace, project_id: project, id: 42 expect(response).to have_http_status(404) end @@ -364,8 +364,8 @@ describe Projects::SnippetsController do context 'CRLF line ending' do let(:params) do { - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, id: project_snippet.to_param } end diff --git a/spec/controllers/projects/tags_controller_spec.rb b/spec/controllers/projects/tags_controller_spec.rb index c36a5fdd66c..fc97bac64cd 100644 --- a/spec/controllers/projects/tags_controller_spec.rb +++ b/spec/controllers/projects/tags_controller_spec.rb @@ -6,7 +6,7 @@ describe Projects::TagsController do let!(:invalid_release) { create(:release, project: project, tag: 'does-not-exist') } describe 'GET index' do - before { get :index, namespace_id: project.namespace.to_param, project_id: project.to_param } + before { get :index, namespace_id: project.namespace.to_param, project_id: project } it 'returns the tags for the page' do expect(assigns(:tags).map(&:name)).to eq(['v1.1.0', 'v1.0.0']) @@ -19,7 +19,7 @@ describe Projects::TagsController do end describe 'GET show' do - before { get :show, namespace_id: project.namespace.to_param, project_id: project.to_param, id: id } + before { get :show, namespace_id: project.namespace.to_param, project_id: project, id: id } context "valid tag" do let(:id) { 'v1.0.0' } diff --git a/spec/controllers/projects/templates_controller_spec.rb b/spec/controllers/projects/templates_controller_spec.rb index 80f84a388ce..066a1831852 100644 --- a/spec/controllers/projects/templates_controller_spec.rb +++ b/spec/controllers/projects/templates_controller_spec.rb @@ -20,7 +20,7 @@ describe Projects::TemplatesController do describe '#show' do it 'renders template name and content as json' do - get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project.path, format: :json) + get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project, format: :json) expect(response.status).to eq(200) expect(body["name"]).to eq("bug") @@ -29,21 +29,21 @@ describe Projects::TemplatesController do it 'renders 404 when unauthorized' do sign_in(user2) - get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project.path, format: :json) + get(:show, namespace_id: project.namespace.to_param, template_type: "issue", key: "bug", project_id: project, format: :json) expect(response.status).to eq(404) end it 'renders 404 when template type is not found' do sign_in(user) - get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project.path, format: :json) + get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project, format: :json) expect(response.status).to eq(404) end it 'renders 404 without errors' do sign_in(user) - expect { get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project.path, format: :json) }.not_to raise_error + expect { get(:show, namespace_id: project.namespace.to_param, template_type: "dont_exist", key: "bug", project_id: project, format: :json) }.not_to raise_error end end end diff --git a/spec/controllers/projects/todo_controller_spec.rb b/spec/controllers/projects/todo_controller_spec.rb index 415c264e0dd..9a7beeff6fe 100644 --- a/spec/controllers/projects/todo_controller_spec.rb +++ b/spec/controllers/projects/todo_controller_spec.rb @@ -12,8 +12,8 @@ describe Projects::TodosController do describe 'POST create' do def go post :create, - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, issuable_id: issue.id, issuable_type: 'issue', format: 'html' @@ -80,8 +80,8 @@ describe Projects::TodosController do describe 'POST create' do def go post :create, - namespace_id: project.namespace.path, - project_id: project.path, + namespace_id: project.namespace, + project_id: project, issuable_id: merge_request.id, issuable_type: 'merge_request', format: 'html' diff --git a/spec/controllers/projects/tree_controller_spec.rb b/spec/controllers/projects/tree_controller_spec.rb index b81645a3d2d..ab94e292e48 100644 --- a/spec/controllers/projects/tree_controller_spec.rb +++ b/spec/controllers/projects/tree_controller_spec.rb @@ -18,7 +18,7 @@ describe Projects::TreeController do before do get(:show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: id) end @@ -74,7 +74,7 @@ describe Projects::TreeController do before do get(:show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: id) end @@ -94,7 +94,7 @@ describe Projects::TreeController do before do post(:create_dir, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: 'master', dir_name: path, target_branch: target_branch, diff --git a/spec/controllers/projects/uploads_controller_spec.rb b/spec/controllers/projects/uploads_controller_spec.rb index 0347e789576..699c6f77cec 100644 --- a/spec/controllers/projects/uploads_controller_spec.rb +++ b/spec/controllers/projects/uploads_controller_spec.rb @@ -16,7 +16,7 @@ describe Projects::UploadsController do it "returns an error" do post :create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, format: :json expect(response).to have_http_status(422) end @@ -26,7 +26,7 @@ describe Projects::UploadsController do before do post :create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, file: jpg, format: :json end @@ -41,7 +41,7 @@ describe Projects::UploadsController do before do post :create, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, file: txt, format: :json end @@ -57,7 +57,7 @@ describe Projects::UploadsController do let(:go) do get :show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, secret: "123456", filename: "image.jpg" end diff --git a/spec/controllers/projects/variables_controller_spec.rb b/spec/controllers/projects/variables_controller_spec.rb index 9fa358f7d62..e3f3b4fe8eb 100644 --- a/spec/controllers/projects/variables_controller_spec.rb +++ b/spec/controllers/projects/variables_controller_spec.rb @@ -12,7 +12,7 @@ describe Projects::VariablesController do describe 'POST #create' do context 'variable is valid' do it 'shows a success flash message' do - post :create, namespace_id: project.namespace.to_param, project_id: project.to_param, + post :create, namespace_id: project.namespace.to_param, project_id: project, variable: { key: "one", value: "two" } expect(flash[:notice]).to include 'Variables were successfully updated.' @@ -22,7 +22,7 @@ describe Projects::VariablesController do context 'variable is invalid' do it 'shows an alert flash message' do - post :create, namespace_id: project.namespace.to_param, project_id: project.to_param, + post :create, namespace_id: project.namespace.to_param, project_id: project, variable: { key: "..one", value: "two" } expect(response).to render_template("projects/variables/show") @@ -40,7 +40,7 @@ describe Projects::VariablesController do end it 'shows a success flash message' do - post :update, namespace_id: project.namespace.to_param, project_id: project.to_param, + post :update, namespace_id: project.namespace.to_param, project_id: project, id: variable.id, variable: { key: variable.key, value: 'two' } expect(flash[:notice]).to include 'Variable was successfully updated.' @@ -48,7 +48,7 @@ describe Projects::VariablesController do end it 'renders the action #show if the variable key is invalid' do - post :update, namespace_id: project.namespace.to_param, project_id: project.to_param, + post :update, namespace_id: project.namespace.to_param, project_id: project, id: variable.id, variable: { key: '?', value: variable.value } expect(response).to have_http_status(200) diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index e7aa8745b99..202759664a0 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -35,7 +35,7 @@ describe ProjectsController do let(:private_project) { create(:empty_project, :private) } it "does not initialize notification setting" do - get :show, namespace_id: private_project.namespace.path, id: private_project.path + get :show, namespace_id: private_project.namespace, id: private_project expect(assigns(:notification_setting)).to be_nil end end @@ -43,7 +43,7 @@ describe ProjectsController do context "user has access to project" do context "and does not have notification setting" do it "initializes notification as disabled" do - get :show, namespace_id: public_project.namespace.path, id: public_project.path + get :show, namespace_id: public_project.namespace, id: public_project expect(assigns(:notification_setting).level).to eq("global") end end @@ -56,7 +56,7 @@ describe ProjectsController do end it "shows current notification setting" do - get :show, namespace_id: public_project.namespace.path, id: public_project.path + get :show, namespace_id: public_project.namespace, id: public_project expect(assigns(:notification_setting).level).to eq("watch") end end @@ -71,7 +71,7 @@ describe ProjectsController do end it 'shows wiki homepage' do - get :show, namespace_id: project.namespace.path, id: project.path + get :show, namespace_id: project.namespace, id: project expect(response).to render_template('projects/_wiki') end @@ -79,7 +79,7 @@ describe ProjectsController do it 'shows issues list page if wiki is disabled' do project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::DISABLED) - get :show, namespace_id: project.namespace.path, id: project.path + get :show, namespace_id: project.namespace, id: project expect(response).to render_template('projects/issues/_issues') end @@ -88,7 +88,7 @@ describe ProjectsController do project.project_feature.update_attribute(:wiki_access_level, ProjectFeature::DISABLED) project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED) - get :show, namespace_id: project.namespace.path, id: project.path + get :show, namespace_id: project.namespace, id: project expect(response).to render_template("projects/_customize_workflow") end @@ -96,7 +96,7 @@ describe ProjectsController do it 'shows activity if enabled by user' do user.update_attribute(:project_view, 'activity') - get :show, namespace_id: project.namespace.path, id: project.path + get :show, namespace_id: project.namespace, id: project expect(response).to render_template("projects/_activity") end @@ -113,7 +113,7 @@ describe ProjectsController do before do user.update_attributes(project_view: project_view) - get :show, namespace_id: empty_project.namespace.path, id: empty_project.path + get :show, namespace_id: empty_project.namespace, id: empty_project end it "renders the empty project view" do @@ -133,7 +133,7 @@ describe ProjectsController do before do user.update_attributes(project_view: project_view) - get :show, namespace_id: empty_project.namespace.path, id: empty_project.path + get :show, namespace_id: empty_project.namespace, id: empty_project end it "renders the empty project view" do @@ -154,7 +154,7 @@ describe ProjectsController do allow(controller).to receive(:current_user).and_return(user) allow(user).to receive(:project_view).and_return('activity') - get :show, namespace_id: public_project.namespace.path, id: public_project.path + get :show, namespace_id: public_project.namespace, id: public_project expect(response).to render_template('_activity') end @@ -162,7 +162,7 @@ describe ProjectsController do allow(controller).to receive(:current_user).and_return(user) allow(user).to receive(:project_view).and_return('readme') - get :show, namespace_id: public_project.namespace.path, id: public_project.path + get :show, namespace_id: public_project.namespace, id: public_project expect(response).to render_template('_readme') end @@ -170,7 +170,7 @@ describe ProjectsController do allow(controller).to receive(:current_user).and_return(user) allow(user).to receive(:project_view).and_return('files') - get :show, namespace_id: public_project.namespace.path, id: public_project.path + get :show, namespace_id: public_project.namespace, id: public_project expect(response).to render_template('_files') end end @@ -178,7 +178,7 @@ describe ProjectsController do context "when requested with case sensitive namespace and project path" do context "when there is a match with the same casing" do it "loads the project" do - get :show, namespace_id: public_project.namespace.path, id: public_project.path + get :show, namespace_id: public_project.namespace, id: public_project expect(assigns(:project)).to eq(public_project) expect(response).to have_http_status(200) @@ -187,10 +187,10 @@ describe ProjectsController do context "when there is a match with different casing" do it "redirects to the normalized path" do - get :show, namespace_id: public_project.namespace.path, id: public_project.path.upcase + get :show, namespace_id: public_project.namespace, id: public_project.path.upcase expect(assigns(:project)).to eq(public_project) - expect(response).to redirect_to("/#{public_project.path_with_namespace}") + expect(response).to redirect_to("/#{public_project.full_path}") end end end @@ -208,7 +208,7 @@ describe ProjectsController do project = create(:empty_project, pending_delete: true) sign_in(user) - get :show, namespace_id: project.namespace.path, id: project.path + get :show, namespace_id: project.namespace, id: project expect(response.status).to eq 404 end @@ -218,7 +218,7 @@ describe ProjectsController do it 'redirects to project page (format.html)' do project = create(:project, :public) - get :show, namespace_id: project.namespace.path, id: project.path, format: :git + get :show, namespace_id: project.namespace, id: project, format: :git expect(response).to have_http_status(302) expect(response).to redirect_to(namespace_project_path) @@ -239,7 +239,7 @@ describe ProjectsController do sign_in(admin) put :update, - namespace_id: project.namespace.to_param, + namespace_id: project.namespace, id: project.id, project: project_params @@ -257,7 +257,7 @@ describe ProjectsController do sign_in(admin) orig_id = project.id - delete :destroy, namespace_id: project.namespace.path, id: project.path + delete :destroy, namespace_id: project.namespace, id: project expect { Project.find(orig_id) }.to raise_error(ActiveRecord::RecordNotFound) expect(response).to have_http_status(302) @@ -277,7 +277,7 @@ describe ProjectsController do project.merge_requests << merge_request sign_in(admin) - delete :destroy, namespace_id: fork_project.namespace.path, id: fork_project.path + delete :destroy, namespace_id: fork_project.namespace, id: fork_project expect(merge_request.reload.state).to eq('closed') end @@ -287,8 +287,8 @@ describe ProjectsController do describe 'PUT #new_issue_address' do subject do put :new_issue_address, - namespace_id: project.namespace.to_param, - id: project.to_param + namespace_id: project.namespace, + id: project user.reload end @@ -316,23 +316,23 @@ describe ProjectsController do sign_in(user) expect(user.starred?(public_project)).to be_falsey post(:toggle_star, - namespace_id: public_project.namespace.to_param, - id: public_project.to_param) + namespace_id: public_project.namespace, + id: public_project) expect(user.starred?(public_project)).to be_truthy post(:toggle_star, - namespace_id: public_project.namespace.to_param, - id: public_project.to_param) + namespace_id: public_project.namespace, + id: public_project) expect(user.starred?(public_project)).to be_falsey end it "does nothing if user is not signed in" do post(:toggle_star, - namespace_id: project.namespace.to_param, - id: public_project.to_param) + namespace_id: project.namespace, + id: public_project) expect(user.starred?(public_project)).to be_falsey post(:toggle_star, - namespace_id: project.namespace.to_param, - id: public_project.to_param) + namespace_id: project.namespace, + id: public_project) expect(user.starred?(public_project)).to be_falsey end end @@ -366,8 +366,8 @@ describe ProjectsController do it 'does nothing if project was not forked' do delete(:remove_fork, - namespace_id: unforked_project.namespace.to_param, - id: unforked_project.to_param, format: :js) + namespace_id: unforked_project.namespace, + id: unforked_project, format: :js) expect(flash[:notice]).to be_nil expect(response).to render_template(:remove_fork) @@ -377,8 +377,8 @@ describe ProjectsController do it "does nothing if user is not signed in" do delete(:remove_fork, - namespace_id: project.namespace.to_param, - id: project.to_param, format: :js) + namespace_id: project.namespace, + id: project, format: :js) expect(response).to have_http_status(401) end end @@ -387,7 +387,7 @@ describe ProjectsController do let(:public_project) { create(:project, :public) } it "gets a list of branches and tags" do - get :refs, namespace_id: public_project.namespace.path, id: public_project.path + get :refs, namespace_id: public_project.namespace, id: public_project parsed_body = JSON.parse(response.body) expect(parsed_body["Branches"]).to include("master") @@ -396,7 +396,7 @@ describe ProjectsController do end it "gets a list of branches, tags and commits" do - get :refs, namespace_id: public_project.namespace.path, id: public_project.path, ref: "123456" + get :refs, namespace_id: public_project.namespace, id: public_project, ref: "123456" parsed_body = JSON.parse(response.body) expect(parsed_body["Branches"]).to include("master") diff --git a/spec/features/dashboard/project_member_activity_index_spec.rb b/spec/features/dashboard/project_member_activity_index_spec.rb index ba77093a6d4..49d93db58a9 100644 --- a/spec/features/dashboard/project_member_activity_index_spec.rb +++ b/spec/features/dashboard/project_member_activity_index_spec.rb @@ -12,7 +12,7 @@ feature 'Project member activity', feature: true, js: true do def visit_activities_and_wait_with_event(event_type) Event.create(project: project, author_id: user.id, action: event_type) - visit activity_namespace_project_path(project.namespace.path, project.path) + visit activity_namespace_project_path(project.namespace, project) wait_for_ajax end diff --git a/spec/features/projects/members/sorting_spec.rb b/spec/features/projects/members/sorting_spec.rb index d6ebb523f95..c7a32a65e49 100644 --- a/spec/features/projects/members/sorting_spec.rb +++ b/spec/features/projects/members/sorting_spec.rb @@ -85,7 +85,7 @@ feature 'Projects > Members > Sorting', feature: true do end def visit_members_list(sort:) - visit namespace_project_project_members_path(project.namespace.to_param, project.to_param, sort: sort) + visit namespace_project_project_members_path(project.namespace.to_param, project, sort: sort) end def first_member diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index fd40fe99941..4ffdd530171 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -58,7 +58,7 @@ describe ApplicationHelper do project = create(:empty_project, avatar: File.open(uploaded_image_temp_path)) avatar_url = "http://#{Gitlab.config.gitlab.host}/uploads/project/avatar/#{project.id}/banana_sample.gif" - expect(helper.project_icon("#{project.namespace.to_param}/#{project.to_param}").to_s). + expect(helper.project_icon(project.full_path).to_s). to eq "<img src=\"#{avatar_url}\" alt=\"Banana sample\" />" end @@ -68,7 +68,7 @@ describe ApplicationHelper do allow_any_instance_of(Project).to receive(:avatar_in_git).and_return(true) avatar_url = "http://#{Gitlab.config.gitlab.host}#{namespace_project_avatar_path(project.namespace, project)}" - expect(helper.project_icon("#{project.namespace.to_param}/#{project.to_param}").to_s).to match( + expect(helper.project_icon(project.full_path).to_s).to match( image_tag(avatar_url)) end end diff --git a/spec/javascripts/fixtures/branches.rb b/spec/javascripts/fixtures/branches.rb index 0e7c2351b66..a059818145b 100644 --- a/spec/javascripts/fixtures/branches.rb +++ b/spec/javascripts/fixtures/branches.rb @@ -20,7 +20,7 @@ describe Projects::BranchesController, '(JavaScript fixtures)', type: :controlle it 'branches/new_branch.html.raw' do |example| get :new, namespace_id: project.namespace.to_param, - project_id: project.to_param + project_id: project expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/builds.rb b/spec/javascripts/fixtures/builds.rb index 978e25a1c32..320de791b08 100644 --- a/spec/javascripts/fixtures/builds.rb +++ b/spec/javascripts/fixtures/builds.rb @@ -24,7 +24,7 @@ describe Projects::BuildsController, '(JavaScript fixtures)', type: :controller it 'builds/build-with-artifacts.html.raw' do |example| get :show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: build_with_artifacts.to_param expect(response).to be_success diff --git a/spec/javascripts/fixtures/issues.rb b/spec/javascripts/fixtures/issues.rb index 06f708f9e15..88e3f860809 100644 --- a/spec/javascripts/fixtures/issues.rb +++ b/spec/javascripts/fixtures/issues.rb @@ -41,7 +41,7 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller def render_issue(fixture_file_name, issue) get :show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: issue.to_param expect(response).to be_success diff --git a/spec/javascripts/fixtures/merge_requests.rb b/spec/javascripts/fixtures/merge_requests.rb index 62984097099..ee893b76c84 100644 --- a/spec/javascripts/fixtures/merge_requests.rb +++ b/spec/javascripts/fixtures/merge_requests.rb @@ -27,7 +27,7 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont def render_merge_request(fixture_file_name, merge_request) get :show, namespace_id: project.namespace.to_param, - project_id: project.to_param, + project_id: project, id: merge_request.to_param expect(response).to be_success diff --git a/spec/javascripts/fixtures/projects.rb b/spec/javascripts/fixtures/projects.rb index 56513219e1e..6c33b240e5c 100644 --- a/spec/javascripts/fixtures/projects.rb +++ b/spec/javascripts/fixtures/projects.rb @@ -20,7 +20,7 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do it 'projects/dashboard.html.raw' do |example| get :show, namespace_id: project.namespace.to_param, - id: project.to_param + id: project expect(response).to be_success store_frontend_fixture(response, example.description) diff --git a/spec/javascripts/fixtures/todos.rb b/spec/javascripts/fixtures/todos.rb index 2c08b06ea9e..a81ef8c5492 100644 --- a/spec/javascripts/fixtures/todos.rb +++ b/spec/javascripts/fixtures/todos.rb @@ -39,8 +39,8 @@ describe 'Todos (JavaScript fixtures)' do it 'todos/todos.json' do |example| post :create, - namespace_id: namespace.path, - project_id: project.path, + namespace_id: namespace, + project_id: project, issuable_type: 'issue', issuable_id: issue_2.id, format: 'json' diff --git a/spec/lib/constraints/project_url_constrainer_spec.rb b/spec/lib/constraints/project_url_constrainer_spec.rb index a5251e9a8c2..4f25ad88960 100644 --- a/spec/lib/constraints/project_url_constrainer_spec.rb +++ b/spec/lib/constraints/project_url_constrainer_spec.rb @@ -6,7 +6,7 @@ describe ProjectUrlConstrainer, lib: true do describe '#matches?' do context 'valid request' do - let(:request) { build_request(namespace.path, project.path) } + let(:request) { build_request(namespace.full_path, project.path) } it { expect(subject.matches?(request)).to be_truthy } end @@ -19,7 +19,7 @@ describe ProjectUrlConstrainer, lib: true do end context "project id ending with .git" do - let(:request) { build_request(namespace.path, project.path + '.git') } + let(:request) { build_request(namespace.full_path, project.path + '.git') } it { expect(subject.matches?(request)).to be_falsey } end diff --git a/spec/lib/gitlab/conflict/file_spec.rb b/spec/lib/gitlab/conflict/file_spec.rb index 7e5531d92dc..780ac0ad97e 100644 --- a/spec/lib/gitlab/conflict/file_spec.rb +++ b/spec/lib/gitlab/conflict/file_spec.rb @@ -251,7 +251,7 @@ FILE describe '#as_json' do it 'includes the blob path for the file' do expect(conflict_file.as_json[:blob_path]). - to eq("/#{project.namespace.to_param}/#{merge_request.project.to_param}/blob/#{our_commit.oid}/files/ruby/regex.rb") + to eq("/#{project.full_path}/blob/#{our_commit.oid}/files/ruby/regex.rb") end it 'includes the blob icon for the file' do diff --git a/spec/lib/gitlab/regex_spec.rb b/spec/lib/gitlab/regex_spec.rb index 089ec4e2737..ba45e2d758c 100644 --- a/spec/lib/gitlab/regex_spec.rb +++ b/spec/lib/gitlab/regex_spec.rb @@ -51,8 +51,8 @@ describe Gitlab::Regex, lib: true do it { is_expected.not_to match('foo-') } end - describe 'NAMESPACE_REF_REGEX_STR' do - subject { %r{\A#{Gitlab::Regex::NAMESPACE_REF_REGEX_STR}\z} } + describe 'FULL_NAMESPACE_REGEX_STR' do + subject { %r{\A#{Gitlab::Regex::FULL_NAMESPACE_REGEX_STR}\z} } it { is_expected.to match('gitlab.org') } it { is_expected.to match('gitlab.org/gitlab-git') } diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 63b6c3c65a6..71cc617e761 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -1239,8 +1239,8 @@ describe Ci::Build, :models do { key: 'CI_SERVER_REVISION', value: Gitlab::REVISION, public: true }, { key: 'CI_PROJECT_ID', value: project.id.to_s, public: true }, { key: 'CI_PROJECT_NAME', value: project.path, public: true }, - { key: 'CI_PROJECT_PATH', value: project.path_with_namespace, public: true }, - { key: 'CI_PROJECT_NAMESPACE', value: project.namespace.path, public: true }, + { key: 'CI_PROJECT_PATH', value: project.full_path, public: true }, + { key: 'CI_PROJECT_NAMESPACE', value: project.namespace.full_path, public: true }, { key: 'CI_PROJECT_URL', value: project.web_url, public: true }, { key: 'CI_PIPELINE_ID', value: pipeline.id.to_s, public: true } ] diff --git a/spec/models/concerns/routable_spec.rb b/spec/models/concerns/routable_spec.rb index e008ec28fa4..677e60e1282 100644 --- a/spec/models/concerns/routable_spec.rb +++ b/spec/models/concerns/routable_spec.rb @@ -86,7 +86,7 @@ describe Group, 'Routable' do let(:nested_group) { create(:group, parent: group) } it { expect(group.full_path).to eq(group.path) } - it { expect(nested_group.full_path).to eq("#{group.path}/#{nested_group.path}") } + it { expect(nested_group.full_path).to eq("#{group.full_path}/#{nested_group.path}") } end describe '#full_name' do @@ -102,7 +102,7 @@ describe Project, 'Routable' do describe '#full_path' do let(:project) { build_stubbed(:empty_project) } - it { expect(project.full_path).to eq "#{project.namespace.path}/#{project.path}" } + it { expect(project.full_path).to eq "#{project.namespace.full_path}/#{project.path}" } end describe '#full_name' do diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb index 35d932f1c64..3f9c4289de9 100644 --- a/spec/models/namespace_spec.rb +++ b/spec/models/namespace_spec.rb @@ -36,7 +36,7 @@ describe Namespace, models: true do end describe '#to_param' do - it { expect(namespace.to_param).to eq(namespace.path) } + it { expect(namespace.to_param).to eq(namespace.full_path) } end describe '#human_name' do @@ -151,7 +151,7 @@ describe Namespace, models: true do describe :rm_dir do let!(:project) { create(:empty_project, namespace: namespace) } - let!(:path) { File.join(Gitlab.config.repositories.storages.default, namespace.path) } + let!(:path) { File.join(Gitlab.config.repositories.storages.default, namespace.full_path) } it "removes its dirs when deleted" do namespace.destroy diff --git a/spec/models/project_services/drone_ci_service_spec.rb b/spec/models/project_services/drone_ci_service_spec.rb index 47ca802ebc2..044737c6026 100644 --- a/spec/models/project_services/drone_ci_service_spec.rb +++ b/spec/models/project_services/drone_ci_service_spec.rb @@ -28,7 +28,7 @@ describe DroneCiService, models: true, caching: true do shared_context :drone_ci_service do let(:drone) { DroneCiService.new } let(:project) { create(:project, :repository, name: 'project') } - let(:path) { "#{project.namespace.path}/#{project.path}" } + let(:path) { project.full_path } let(:drone_url) { 'http://drone.example.com' } let(:sha) { '2ab7834c' } let(:branch) { 'dev' } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index b0087a9e15d..8a27dfff203 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -402,7 +402,7 @@ describe Project, models: true do let(:project) { create(:empty_project, path: "somewhere") } it 'returns the full web URL for this repo' do - expect(project.web_url).to eq("#{Gitlab.config.gitlab.url}/#{project.namespace.path}/somewhere") + expect(project.web_url).to eq("#{Gitlab.config.gitlab.url}/#{project.namespace.full_path}/somewhere") end end @@ -803,7 +803,7 @@ describe Project, models: true do end let(:avatar_path) do - "/#{project.namespace.name}/#{project.path}/avatar" + "/#{project.full_path}/avatar" end it { should eq "http://#{Gitlab.config.gitlab.host}#{avatar_path}" } @@ -1148,16 +1148,14 @@ describe Project, models: true do end it 'renames a repository' do - ns = project.namespace_dir - expect(gitlab_shell).to receive(:mv_repository). ordered. - with(project.repository_storage_path, "#{ns}/foo", "#{ns}/#{project.path}"). + with(project.repository_storage_path, "#{project.namespace.full_path}/foo", "#{project.full_path}"). and_return(true) expect(gitlab_shell).to receive(:mv_repository). ordered. - with(project.repository_storage_path, "#{ns}/foo.wiki", "#{ns}/#{project.path}.wiki"). + with(project.repository_storage_path, "#{project.namespace.full_path}/foo.wiki", "#{project.full_path}.wiki"). and_return(true) expect_any_instance_of(SystemHooksService). @@ -1166,7 +1164,7 @@ describe Project, models: true do expect_any_instance_of(Gitlab::UploadsTransfer). to receive(:rename_project). - with('foo', project.path, ns) + with('foo', project.path, project.namespace.full_path) expect(project).to receive(:expire_caches_before_rename) @@ -1538,7 +1536,7 @@ describe Project, models: true do it 'schedules a RepositoryForkWorker job' do expect(RepositoryForkWorker).to receive(:perform_async). with(project.id, forked_from_project.repository_storage_path, - forked_from_project.path_with_namespace, project.namespace.path) + forked_from_project.path_with_namespace, project.namespace.full_path) project.add_import_job end @@ -1752,7 +1750,7 @@ describe Project, models: true do describe 'inside_path' do let!(:project1) { create(:empty_project) } let!(:project2) { create(:empty_project) } - let!(:path) { project1.namespace.path } + let!(:path) { project1.namespace.full_path } it { expect(Project.inside_path(path)).to eq([project1]) } end diff --git a/spec/requests/api/commits_spec.rb b/spec/requests/api/commits_spec.rb index 8b3dfedc5a9..5190fcca2d1 100644 --- a/spec/requests/api/commits_spec.rb +++ b/spec/requests/api/commits_spec.rb @@ -148,7 +148,7 @@ describe API::Commits, api: true do end context 'with project path in URL' do - let(:url) { "/projects/#{project.namespace.path}%2F#{project.path}/repository/commits" } + let(:url) { "/projects/#{project.full_path.gsub('/', '%2F')}/repository/commits" } it 'a new file in project repo' do post api(url, user), valid_c_params diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 9c3a92bedbd..cd6bc928f43 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -519,7 +519,7 @@ describe API::Groups, api: true do describe "POST /groups/:id/projects/:project_id" do let(:project) { create(:empty_project) } - let(:project_path) { "#{project.namespace.path}%2F#{project.path}" } + let(:project_path) { project.full_path.gsub('/', '%2F') } before(:each) do allow_any_instance_of(Projects::TransferService). diff --git a/spec/requests/api/v3/commits_spec.rb b/spec/requests/api/v3/commits_spec.rb index 2d7584c3e59..e298ef055e1 100644 --- a/spec/requests/api/v3/commits_spec.rb +++ b/spec/requests/api/v3/commits_spec.rb @@ -148,7 +148,7 @@ describe API::V3::Commits, api: true do end context 'with project path in URL' do - let(:url) { "/projects/#{project.namespace.path}%2F#{project.path}/repository/commits" } + let(:url) { "/projects/#{project.full_path.gsub('/', '%2F')}/repository/commits" } it 'a new file in project repo' do post v3_api(url, user), valid_c_params diff --git a/spec/support/issuables_list_metadata_shared_examples.rb b/spec/support/issuables_list_metadata_shared_examples.rb index 4644c7a6b86..4c0f556e736 100644 --- a/spec/support/issuables_list_metadata_shared_examples.rb +++ b/spec/support/issuables_list_metadata_shared_examples.rb @@ -22,7 +22,7 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil| if action get action else - get :index, namespace_id: project.namespace.path, project_id: project.path + get :index, namespace_id: project.namespace, project_id: project end meta_data = assigns(:issuable_meta_data) diff --git a/spec/support/markdown_feature.rb b/spec/support/markdown_feature.rb index a79386b5db9..5980d14c8ae 100644 --- a/spec/support/markdown_feature.rb +++ b/spec/support/markdown_feature.rb @@ -79,8 +79,9 @@ class MarkdownFeature def xproject @xproject ||= begin - namespace = create(:namespace, name: 'cross-reference') - create(:project, namespace: namespace) do |project| + group = create(:group, name: 'cross-reference') + group2 = create(:group, parent: group, name: 'nested-group') + create(:project, namespace: group2) do |project| project.team << [user, :developer] end end diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index 4e63a4cd537..c3aa3ef44c2 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -135,7 +135,7 @@ module TestEnv def copy_repo(project) base_repo_path = File.expand_path(factory_repo_path_bare) - target_repo_path = File.expand_path(project.repository_storage_path + "/#{project.namespace.path}/#{project.path}.git") + target_repo_path = File.expand_path(project.repository_storage_path + "/#{project.full_path}.git") FileUtils.mkdir_p(target_repo_path) FileUtils.cp_r("#{base_repo_path}/.", target_repo_path) FileUtils.chmod_R 0755, target_repo_path @@ -152,7 +152,7 @@ module TestEnv def copy_forked_repo_with_submodules(project) base_repo_path = File.expand_path(forked_repo_path_bare) - target_repo_path = File.expand_path(project.repository_storage_path + "/#{project.namespace.path}/#{project.path}.git") + target_repo_path = File.expand_path(project.repository_storage_path + "/#{project.full_path}.git") FileUtils.mkdir_p(target_repo_path) FileUtils.cp_r("#{base_repo_path}/.", target_repo_path) FileUtils.chmod_R 0755, target_repo_path diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb index 60605460adb..87521ae408e 100644 --- a/spec/workers/repository_fork_worker_spec.rb +++ b/spec/workers/repository_fork_worker_spec.rb @@ -15,24 +15,24 @@ describe RepositoryForkWorker do it "creates a new repository from a fork" do expect(shell).to receive(:fork_repository).with( '/test/path', - project.path_with_namespace, + project.full_path, project.repository_storage_path, - fork_project.namespace.path + fork_project.namespace.full_path ).and_return(true) subject.perform( project.id, '/test/path', - project.path_with_namespace, - fork_project.namespace.path) + project.full_path, + fork_project.namespace.full_path) end it 'flushes various caches' do expect(shell).to receive(:fork_repository).with( '/test/path', - project.path_with_namespace, + project.full_path, project.repository_storage_path, - fork_project.namespace.path + fork_project.namespace.full_path ).and_return(true) expect_any_instance_of(Repository).to receive(:expire_emptiness_caches). @@ -41,8 +41,8 @@ describe RepositoryForkWorker do expect_any_instance_of(Repository).to receive(:expire_exists_cache). and_call_original - subject.perform(project.id, '/test/path', project.path_with_namespace, - fork_project.namespace.path) + subject.perform(project.id, '/test/path', project.full_path, + fork_project.namespace.full_path) end it "handles bad fork" do @@ -53,8 +53,8 @@ describe RepositoryForkWorker do subject.perform( project.id, '/test/path', - project.path_with_namespace, - fork_project.namespace.path) + project.full_path, + fork_project.namespace.full_path) end end end |