Commit ad640bc5 authored by Douwe Maan's avatar Douwe Maan

Use Namespace#full_path instead of #path where appropriate

parent 509ff2ab
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
$value = $block.find('.value'); $value = $block.find('.value');
$loading = $block.find('.block-loading').fadeOut(); $loading = $block.find('.block-loading').fadeOut();
if (issueUpdateURL) { 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>'; milestoneLinkNoneTemplate = '<span class="no-value">None</span>';
collapsedSidebarLabelTemplate = _.template('<span class="has-tooltip" data-container="body" title="<%- remaining %>" data-placement="left"> <%- title %> </span>'); collapsedSidebarLabelTemplate = _.template('<span class="has-tooltip" data-container="body" title="<%- remaining %>" data-placement="left"> <%- title %> </span>');
} }
...@@ -181,8 +181,7 @@ ...@@ -181,8 +181,7 @@
$selectbox.hide(); $selectbox.hide();
$value.css('display', ''); $value.css('display', '');
if (data.milestone != null) { if (data.milestone != null) {
data.milestone.namespace = _this.currentProject.namespace; data.milestone.full_path = _this.currentProject.full_path;
data.milestone.path = _this.currentProject.path;
data.milestone.remaining = gl.utils.timeFor(data.milestone.due_date); data.milestone.remaining = gl.utils.timeFor(data.milestone.due_date);
$value.html(milestoneLinkTemplate(data.milestone)); $value.html(milestoneLinkTemplate(data.milestone));
return $sidebarCollapsedValue.find('span').html(collapsedSidebarLabelTemplate(data.milestone)); return $sidebarCollapsedValue.find('span').html(collapsedSidebarLabelTemplate(data.milestone));
......
...@@ -52,7 +52,7 @@ module IssuablesHelper ...@@ -52,7 +52,7 @@ module IssuablesHelper
field_name: 'issuable_template', field_name: 'issuable_template',
selected: selected_template(issuable), selected: selected_template(issuable),
project_path: ref_project.path, project_path: ref_project.path,
namespace_path: ref_project.namespace.path namespace_path: ref_project.namespace.full_path
} }
} }
......
...@@ -360,7 +360,7 @@ class Project < ActiveRecord::Base ...@@ -360,7 +360,7 @@ class Project < ActiveRecord::Base
end end
def reference_pattern def reference_pattern
name_pattern = Gitlab::Regex::NAMESPACE_REGEX_STR name_pattern = Gitlab::Regex::FULL_NAMESPACE_REGEX_STR
%r{ %r{
((?<namespace>#{name_pattern})\/)? ((?<namespace>#{name_pattern})\/)?
...@@ -848,10 +848,6 @@ class Project < ActiveRecord::Base ...@@ -848,10 +848,6 @@ class Project < ActiveRecord::Base
gitlab_shell.url_to_repo(path_with_namespace) gitlab_shell.url_to_repo(path_with_namespace)
end end
def namespace_dir
namespace.try(:path) || ''
end
def repo_exists? def repo_exists?
@repo_exists ||= repository.exists? @repo_exists ||= repository.exists?
rescue rescue
...@@ -900,8 +896,8 @@ class Project < ActiveRecord::Base ...@@ -900,8 +896,8 @@ class Project < ActiveRecord::Base
def rename_repo def rename_repo
path_was = previous_changes['path'].first path_was = previous_changes['path'].first
old_path_with_namespace = File.join(namespace_dir, path_was) old_path_with_namespace = File.join(namespace.full_path, path_was)
new_path_with_namespace = File.join(namespace_dir, path) new_path_with_namespace = File.join(namespace.full_path, path)
Rails.logger.error "Attempting to rename #{old_path_with_namespace} -> #{new_path_with_namespace}" Rails.logger.error "Attempting to rename #{old_path_with_namespace} -> #{new_path_with_namespace}"
......
...@@ -334,7 +334,7 @@ class User < ActiveRecord::Base ...@@ -334,7 +334,7 @@ class User < ActiveRecord::Base
def reference_pattern def reference_pattern
%r{ %r{
#{Regexp.escape(reference_prefix)} #{Regexp.escape(reference_prefix)}
(?<user>#{Gitlab::Regex::NAMESPACE_REF_REGEX_STR}) (?<user>#{Gitlab::Regex::FULL_NAMESPACE_REGEX_STR})
}x }x
end end
end end
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
= f.text_field :name, class: "form-control top", required: true, title: "This field is required." = f.text_field :name, class: "form-control top", required: true, title: "This field is required."
.username.form-group .username.form-group
= f.label :username = 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-error.hide Username is already taken.
%p.validation-success.hide Username is available. %p.validation-success.hide Username is available.
%p.validation-pending.hide Checking username availability... %p.validation-pending.hide Checking username availability...
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
.form-group .form-group
- if @project.avatar? - if @project.avatar?
.avatar-container.s160 .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 %p.light
- if @project.avatar_in_git - if @project.avatar_in_git
Project avatar in repository: #{ @project.avatar_in_git } Project avatar in repository: #{ @project.avatar_in_git }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
%strong= parent.full_path + '/' %strong= parent.full_path + '/'
= f.text_field :path, placeholder: 'open-source', class: 'form-control', = f.text_field :path, placeholder: 'open-source', class: 'form-control',
autofocus: local_assigns[:autofocus] || false, required: true, 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.' title: 'Please choose a group name with no special characters.'
- if parent - if parent
= f.hidden_field :parent_id, value: parent.id = f.hidden_field :parent_id, value: parent.id
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
:javascript :javascript
gl.IssuableResource = new gl.SubbableResource('#{issuable_json_path(issuable)}'); gl.IssuableResource = new gl.SubbableResource('#{issuable_json_path(issuable)}');
new gl.IssuableTimeTracking("#{escape_javascript(serialize_issuable(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 LabelsSelect();
new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}'); new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}');
gl.Subscription.bindAll('.subscription'); gl.Subscription.bindAll('.subscription');
......
...@@ -35,7 +35,7 @@ module Gitlab ...@@ -35,7 +35,7 @@ module Gitlab
end end
def export_filename(project:) 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" "#{basename[0..FILENAME_LIMIT]}_export.tar.gz"
end end
......
...@@ -5,17 +5,18 @@ module Gitlab ...@@ -5,17 +5,18 @@ module Gitlab
# The namespace regex is used in Javascript to validate usernames in the "Register" form. However, Javascript # 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`. # 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 # 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 # `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. # 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 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_JS = PATH_REGEX_STR + '[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'.freeze
NAMESPACE_REGEX_STR = '(?:' + NAMESPACE_REGEX_STR_SIMPLE + ')(?<!\.git|\.atom)'.freeze NO_SUFFIX_REGEX_STR = '(?<!\.git|\.atom)'.freeze
PROJECT_REGEX_STR = PATH_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. # Same as NAMESPACE_REGEX_STR but allows `/` in the path.
# So `group/subgroup` will match this regex but not NAMESPACE_REGEX_STR # 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 def namespace_regex
@namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze @namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze
......
...@@ -19,8 +19,8 @@ describe Projects::BlobController do ...@@ -19,8 +19,8 @@ describe Projects::BlobController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
...@@ -50,8 +50,8 @@ describe Projects::BlobController do ...@@ -50,8 +50,8 @@ describe Projects::BlobController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id) id: id)
controller.instance_variable_set(:@blob, nil) controller.instance_variable_set(:@blob, nil)
end end
......
...@@ -16,8 +16,8 @@ describe Projects::BlameController do ...@@ -16,8 +16,8 @@ describe Projects::BlameController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
......
...@@ -14,8 +14,8 @@ describe Projects::BlobController do ...@@ -14,8 +14,8 @@ describe Projects::BlobController do
render_views render_views
def do_get(opts = {}) def do_get(opts = {})
params = { namespace_id: project.namespace.to_param, params = { namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: 'master/CHANGELOG' } id: 'master/CHANGELOG' }
get :diff, params.merge(opts) get :diff, params.merge(opts)
end end
...@@ -40,8 +40,8 @@ describe Projects::BlobController do ...@@ -40,8 +40,8 @@ describe Projects::BlobController do
describe 'PUT update' do describe 'PUT update' do
let(:default_params) do let(:default_params) do
{ {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: 'master/CHANGELOG', id: 'master/CHANGELOG',
target_branch: 'master', target_branch: 'master',
content: 'Added changes', content: 'Added changes',
...@@ -96,8 +96,8 @@ describe Projects::BlobController do ...@@ -96,8 +96,8 @@ describe Projects::BlobController do
context 'when editing on the fork' do context 'when editing on the fork' do
before do before do
default_params[:namespace_id] = forked_project.namespace.to_param default_params[:namespace_id] = forked_project.namespace
default_params[:project_id] = forked_project.to_param default_params[:project_id] = forked_project
end end
it 'redirects to blob' do it 'redirects to blob' do
......
...@@ -90,7 +90,7 @@ describe Projects::Boards::IssuesController do ...@@ -90,7 +90,7 @@ describe Projects::Boards::IssuesController do
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
list_id: list.try(:to_param) list_id: list.try(:to_param)
} }
...@@ -146,7 +146,7 @@ describe Projects::Boards::IssuesController do ...@@ -146,7 +146,7 @@ describe Projects::Boards::IssuesController do
sign_in(user) sign_in(user)
post :create, namespace_id: project.namespace.to_param, post :create, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
list_id: list.to_param, list_id: list.to_param,
issue: { title: title }, issue: { title: title },
...@@ -209,7 +209,7 @@ describe Projects::Boards::IssuesController do ...@@ -209,7 +209,7 @@ describe Projects::Boards::IssuesController do
sign_in(user) sign_in(user)
patch :update, namespace_id: project.namespace.to_param, patch :update, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
id: issue.to_param, id: issue.to_param,
from_list_id: from_list_id, from_list_id: from_list_id,
......
...@@ -47,7 +47,7 @@ describe Projects::Boards::ListsController do ...@@ -47,7 +47,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
get :index, namespace_id: project.namespace.to_param, get :index, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
format: :json format: :json
end end
...@@ -104,7 +104,7 @@ describe Projects::Boards::ListsController do ...@@ -104,7 +104,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
post :create, namespace_id: project.namespace.to_param, post :create, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
list: { label_id: label_id }, list: { label_id: label_id },
format: :json format: :json
...@@ -157,7 +157,7 @@ describe Projects::Boards::ListsController do ...@@ -157,7 +157,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
patch :update, namespace_id: project.namespace.to_param, patch :update, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
id: list.to_param, id: list.to_param,
list: { position: position }, list: { position: position },
...@@ -200,7 +200,7 @@ describe Projects::Boards::ListsController do ...@@ -200,7 +200,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
delete :destroy, namespace_id: project.namespace.to_param, delete :destroy, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
id: list.to_param, id: list.to_param,
format: :json format: :json
...@@ -244,7 +244,7 @@ describe Projects::Boards::ListsController do ...@@ -244,7 +244,7 @@ describe Projects::Boards::ListsController do
sign_in(user) sign_in(user)
post :generate, namespace_id: project.namespace.to_param, post :generate, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
board_id: board.to_param, board_id: board.to_param,
format: :json format: :json
end end
......
...@@ -50,8 +50,8 @@ describe Projects::BoardsController do ...@@ -50,8 +50,8 @@ describe Projects::BoardsController do
end end
def list_boards(format: :html) def list_boards(format: :html)
get :index, namespace_id: project.namespace.to_param, get :index, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
format: format format: format
end end
end end
...@@ -100,8 +100,8 @@ describe Projects::BoardsController do ...@@ -100,8 +100,8 @@ describe Projects::BoardsController do
end end
def read_board(board:, format: :html) def read_board(board:, format: :html)
get :show, namespace_id: project.namespace.to_param, get :show, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: board.to_param, id: board.to_param,
format: format format: format
end end
......
...@@ -22,8 +22,8 @@ describe Projects::BranchesController do ...@@ -22,8 +22,8 @@ describe Projects::BranchesController do
sign_in(user) sign_in(user)
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
branch_name: branch, branch_name: branch,
ref: ref ref: ref
end end
...@@ -76,8 +76,8 @@ describe Projects::BranchesController do ...@@ -76,8 +76,8 @@ describe Projects::BranchesController do
it 'redirects' do it 'redirects' do
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
branch_name: branch, branch_name: branch,
issue_iid: issue.iid issue_iid: issue.iid
...@@ -89,8 +89,8 @@ describe Projects::BranchesController do ...@@ -89,8 +89,8 @@ describe Projects::BranchesController do
expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch") expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, "1-feature-branch")
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
branch_name: branch, branch_name: branch,
issue_iid: issue.iid issue_iid: issue.iid
end end
...@@ -106,8 +106,8 @@ describe Projects::BranchesController do ...@@ -106,8 +106,8 @@ describe Projects::BranchesController do
expect(SystemNoteService).not_to receive(:new_issue_branch) expect(SystemNoteService).not_to receive(:new_issue_branch)
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
branch_name: branch, branch_name: branch,
issue_iid: issue.iid issue_iid: issue.iid
end end
...@@ -126,8 +126,8 @@ describe Projects::BranchesController do ...@@ -126,8 +126,8 @@ describe Projects::BranchesController do
post :destroy, post :destroy,
format: :html, format: :html,
id: 'foo/bar/baz', id: 'foo/bar/baz',
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
expect(response).to have_http_status(303) expect(response).to have_http_status(303)
end end
...@@ -142,8 +142,8 @@ describe Projects::BranchesController do ...@@ -142,8 +142,8 @@ describe Projects::BranchesController do
post :destroy, post :destroy,
format: :js, format: :js,
id: branch, id: branch,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
end end
context "valid branch name, valid source" do context "valid branch name, valid source" do
...@@ -173,8 +173,8 @@ describe Projects::BranchesController do ...@@ -173,8 +173,8 @@ describe Projects::BranchesController do
describe "DELETE destroy_all_merged" do describe "DELETE destroy_all_merged" do
def destroy_all_merged def destroy_all_merged
delete :destroy_all_merged, delete :destroy_all_merged,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
end end
context 'when user is allowed to push' do context 'when user is allowed to push' do
......
...@@ -17,8 +17,8 @@ describe Projects::CommitController do ...@@ -17,8 +17,8 @@ describe Projects::CommitController do
def go(extra_params = {}) def go(extra_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
} }
get :show, params.merge(extra_params) get :show, params.merge(extra_params)
...@@ -125,8 +125,8 @@ describe Projects::CommitController do ...@@ -125,8 +125,8 @@ describe Projects::CommitController do
it 'renders it' do it 'renders it' do
get(:show, get(:show,
namespace_id: fork_project.namespace.to_param, namespace_id: fork_project.namespace,
project_id: fork_project.to_param, project_id: fork_project,
id: commit.id) id: commit.id)
expect(response).to be_success expect(response).to be_success
...@@ -139,8 +139,8 @@ describe Projects::CommitController do ...@@ -139,8 +139,8 @@ describe Projects::CommitController do
commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e') commit = project.commit('5937ac0a7beb003549fc5fd26fc247adbce4a52e')
get(:branches, get(:branches,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: commit.id) id: commit.id)
expect(assigns(:branches)).to include("master", "feature_conflict") expect(assigns(:branches)).to include("master", "feature_conflict")
...@@ -152,8 +152,8 @@ describe Projects::CommitController do ...@@ -152,8 +152,8 @@ describe Projects::CommitController do
context 'when target branch is not provided' do context 'when target branch is not provided' do
it 'renders the 404 page' do it 'renders the 404 page' do
post(:revert, post(:revert,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: commit.id) id: commit.id)
expect(response).not_to be_success expect(response).not_to be_success
...@@ -164,8 +164,8 @@ describe Projects::CommitController do ...@@ -164,8 +164,8 @@ describe Projects::CommitController do
context 'when the revert was successful' do context 'when the revert was successful' do
it 'redirects to the commits page' do it 'redirects to the commits page' do
post(:revert, post(:revert,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: commit.id) id: commit.id)
...@@ -177,8 +177,8 @@ describe Projects::CommitController do ...@@ -177,8 +177,8 @@ describe Projects::CommitController do
context 'when the revert failed' do context 'when the revert failed' do
before do before do
post(:revert, post(:revert,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: commit.id) id: commit.id)
end end
...@@ -186,8 +186,8 @@ describe Projects::CommitController do ...@@ -186,8 +186,8 @@ describe Projects::CommitController do
it 'redirects to the commit page' do it 'redirects to the commit page' do
# Reverting a commit that has been already reverted. # Reverting a commit that has been already reverted.
post(:revert, post(:revert,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: commit.id) id: commit.id)
...@@ -201,8 +201,8 @@ describe Projects::CommitController do ...@@ -201,8 +201,8 @@ describe Projects::CommitController do
context 'when target branch is not provided' do context 'when target branch is not provided' do
it 'renders the 404 page' do it 'renders the 404 page' do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: master_pickable_commit.id) id: master_pickable_commit.id)
expect(response).not_to be_success expect(response).not_to be_success
...@@ -213,8 +213,8 @@ describe Projects::CommitController do ...@@ -213,8 +213,8 @@ describe Projects::CommitController do
context 'when the cherry-pick was successful' do context 'when the cherry-pick was successful' do
it 'redirects to the commits page' do it 'redirects to the commits page' do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: master_pickable_commit.id) id: master_pickable_commit.id)
...@@ -226,8 +226,8 @@ describe Projects::CommitController do ...@@ -226,8 +226,8 @@ describe Projects::CommitController do
context 'when the cherry_pick failed' do context 'when the cherry_pick failed' do
before do before do
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: master_pickable_commit.id) id: master_pickable_commit.id)
end end
...@@ -235,8 +235,8 @@ describe Projects::CommitController do ...@@ -235,8 +235,8 @@ describe Projects::CommitController do
it 'redirects to the commit page' do it 'redirects to the commit page' do
# Cherry-picking a commit that has been already cherry-picked. # Cherry-picking a commit that has been already cherry-picked.
post(:cherry_pick, post(:cherry_pick,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
target_branch: 'master', target_branch: 'master',
id: master_pickable_commit.id) id: master_pickable_commit.id)
...@@ -249,8 +249,8 @@ describe Projects::CommitController do ...@@ -249,8 +249,8 @@ describe Projects::CommitController do
describe 'GET diff_for_path' do describe 'GET diff_for_path' do
def diff_for_path(extra_params = {}) def diff_for_path(extra_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
} }
get :diff_for_path, params.merge(extra_params) get :diff_for_path, params.merge(extra_params)
...@@ -313,8 +313,8 @@ describe Projects::CommitController do ...@@ -313,8 +313,8 @@ describe Projects::CommitController do
describe 'GET pipelines' do describe 'GET pipelines' do
def get_pipelines(extra_params = {}) def get_pipelines(extra_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
} }
get :pipelines, params.merge(extra_params) get :pipelines, params.merge(extra_params)
......
...@@ -16,8 +16,8 @@ describe Projects::CommitsController do ...@@ -16,8 +16,8 @@ describe Projects::CommitsController do
context "when the ref does not exist with the suffix" do context "when the ref does not exist with the suffix" do
it "renders as atom" do it "renders as atom" do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: "master.atom") id: "master.atom")
expect(response).to be_success expect(response).to be_success
...@@ -33,8 +33,8 @@ describe Projects::CommitsController do ...@@ -33,8 +33,8 @@ describe Projects::CommitsController do
allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit) allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit)
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: "master.atom") id: "master.atom")
end end
......
...@@ -13,8 +13,8 @@ describe Projects::CompareController do ...@@ -13,8 +13,8 @@ describe Projects::CompareController do
it 'compare shows some diffs' do it 'compare shows some diffs' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: ref_from, from: ref_from,
to: ref_to) to: ref_to)
...@@ -25,8 +25,8 @@ describe Projects::CompareController do ...@@ -25,8 +25,8 @@ describe Projects::CompareController do
it 'compare shows some diffs with ignore whitespace change option' do it 'compare shows some diffs with ignore whitespace change option' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: '08f22f25', from: '08f22f25',
to: '66eceea0', to: '66eceea0',
w: 1) w: 1)
...@@ -43,8 +43,8 @@ describe Projects::CompareController do ...@@ -43,8 +43,8 @@ describe Projects::CompareController do
describe 'non-existent refs' do describe 'non-existent refs' do
it 'uses invalid source ref' do it 'uses invalid source ref' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: 'non-existent', from: 'non-existent',
to: ref_to) to: ref_to)
...@@ -55,8 +55,8 @@ describe Projects::CompareController do ...@@ -55,8 +55,8 @@ describe Projects::CompareController do
it 'uses invalid target ref' do it 'uses invalid target ref' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: ref_from, from: ref_from,
to: 'non-existent') to: 'non-existent')
...@@ -67,8 +67,8 @@ describe Projects::CompareController do ...@@ -67,8 +67,8 @@ describe Projects::CompareController do
it 'redirects back to index when params[:from] is empty and preserves params[:to]' do it 'redirects back to index when params[:from] is empty and preserves params[:to]' do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: '', from: '',
to: 'master') to: 'master')
...@@ -77,8 +77,8 @@ describe Projects::CompareController do ...@@ -77,8 +77,8 @@ describe Projects::CompareController do
it 'redirects back to index when params[:to] is empty and preserves params[:from]' do it 'redirects back to index when params[:to] is empty and preserves params[:from]' do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: 'master', from: 'master',
to: '') to: '')
...@@ -87,8 +87,8 @@ describe Projects::CompareController do ...@@ -87,8 +87,8 @@ describe Projects::CompareController do
it 'redirects back to index when params[:from] and params[:to] are empty' do it 'redirects back to index when params[:from] and params[:to] are empty' do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
from: '', from: '',
to: '') to: '')
...@@ -99,8 +99,8 @@ describe Projects::CompareController do ...@@ -99,8 +99,8 @@ describe Projects::CompareController do
describe 'GET diff_for_path' do describe 'GET diff_for_path' do
def diff_for_path(extra_params = {}) def diff_for_path(extra_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
} }
get :diff_for_path, params.merge(extra_params) get :diff_for_path, params.merge(extra_params)
......
...@@ -13,8 +13,8 @@ describe Projects::CycleAnalyticsController do ...@@ -13,8 +13,8 @@ describe Projects::CycleAnalyticsController do
context 'with no data' do context 'with no data' do
it 'is true' do it 'is true' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param) project_id: project)
expect(response).to be_success expect(response).to be_success
expect(assigns(:cycle_analytics_no_data)).to eq(true) expect(assigns(:cycle_analytics_no_data)).to eq(true)
...@@ -32,8 +32,8 @@ describe Projects::CycleAnalyticsController do ...@@ -32,8 +32,8 @@ describe Projects::CycleAnalyticsController do
it 'is false' do it 'is false' do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param) project_id: project)
expect(response).to be_success expect(response).to be_success
expect(assigns(:cycle_analytics_no_data)).to eq(false) expect(assigns(:cycle_analytics_no_data)).to eq(false)
......
...@@ -17,8 +17,8 @@ describe Projects::FindFileController do ...@@ -17,8 +17,8 @@ describe Projects::FindFileController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
...@@ -36,8 +36,8 @@ describe Projects::FindFileController do ...@@ -36,8 +36,8 @@ describe Projects::FindFileController do
describe "GET #list" do describe "GET #list" do
def go(format: 'json') def go(format: 'json')
get :list, get :list,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
id: id, id: id,
format: format format: format
end end
......
...@@ -9,8 +9,8 @@ describe Projects::ForksController do ...@@ -9,8 +9,8 @@ describe Projects::ForksController do
describe 'GET index' do describe 'GET index' do
def get_forks def get_forks
get :index, get :index,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
end end
context 'when fork is public' do context 'when fork is public' do
...@@ -71,8 +71,8 @@ describe Projects::ForksController do ...@@ -71,8 +71,8 @@ describe Projects::ForksController do
describe 'GET new' do describe 'GET new' do
def get_new def get_new
get :new, get :new,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param project_id: project
end end
context 'when user is signed in' do context 'when user is signed in' do
...@@ -99,8 +99,8 @@ describe Projects::ForksController do ...@@ -99,8 +99,8 @@ describe Projects::ForksController do
describe 'POST create' do describe 'POST create' do
def post_create def post_create
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
namespace_key: user.namespace.id namespace_key: user.namespace.id
end end
......
...@@ -34,7 +34,7 @@ describe Projects::GraphsController do ...@@ -34,7 +34,7 @@ describe Projects::GraphsController do
end end
it 'sets the correct colour according to language' do 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| expected_values.each do |val|
expect(assigns(:languages)).to include(a_hash_including(val)) expect(assigns(:languages)).to include(a_hash_including(val))
......
...@@ -14,8 +14,8 @@ describe Projects::GroupLinksController do ...@@ -14,8 +14,8 @@ describe Projects::GroupLinksController do
describe '#create' do describe '#create' do
shared_context 'link project to group' do shared_context 'link project to group' do
before do before do
post(:create, namespace_id: project.namespace.to_param, post(:create, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
link_group_id: group.id, link_group_id: group.id,
link_group_access: ProjectGroupLink.default_access) link_group_access: ProjectGroupLink.default_access)
end end
...@@ -50,8 +50,8 @@ describe Projects::GroupLinksController do ...@@ -50,8 +50,8 @@ describe Projects::GroupLinksController do
context 'when project group id equal link group id' do context 'when project group id equal link group id' do
before do before do
post(:create, namespace_id: project.namespace.to_param, post(:create, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
link_group_id: group2.id, link_group_id: group2.id,
link_group_access: ProjectGroupLink.default_access) link_group_access: ProjectGroupLink.default_access)
end end
...@@ -69,8 +69,8 @@ describe Projects::GroupLinksController do ...@@ -69,8 +69,8 @@ describe Projects::GroupLinksController do
context 'when link group id is not present' do context 'when link group id is not present' do
before do before do
post(:create, namespace_id: project.namespace.to_param, post(:create, namespace_id: project.namespace,
project_id: project.to_param, project_id: project,
link_group_access: ProjectGroupLink.default_access) link_group_access: ProjectGroupLink.default_access)
end end
......
...@@ -13,13 +13,13 @@ describe Projects::ImportsController do ...@@ -13,13 +13,13 @@ describe Projects::ImportsController do
end end
it 'renders template' do 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 expect(response).to render_template :show
end end
it 'sets flash.now if params is present' do 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' expect(flash.now[:notice]).to eq 'Started'
end end
...@@ -39,13 +39,13 @@ describe Projects::ImportsController do ...@@ -39,13 +39,13 @@ describe Projects::ImportsController do
end end
it 'renders template' do 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 expect(response).to render_template :show
end end
it 'sets flash.now if params is present' do 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' expect(flash.now[:notice]).to eq 'In progress'
end end
...@@ -57,7 +57,7 @@ describe Projects::ImportsController do ...@@ -57,7 +57,7 @@ describe Projects::ImportsController do
end end
it 'redirects to new_namespace_project_import_path' do 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) expect(response).to redirect_to new_namespace_project_import_path(project.namespace, project)
end end
...@@ -72,7 +72,7 @@ describe Projects::ImportsController do ...@@ -72,7 +72,7 @@ describe Projects::ImportsController do
it 'redirects to namespace_project_path' do it 'redirects to namespace_project_path' do
allow_any_instance_of(Project).to receive(:forked?).and_return(true) 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(flash[:notice]).to eq 'The project was successfully forked.'
expect(response).to redirect_to namespace_project_path(project.namespace, project) expect(response).to redirect_to namespace_project_path(project.namespace, project)
...@@ -81,7 +81,7 @@ describe Projects::ImportsController do ...@@ -81,7 +81,7 @@ describe Projects::ImportsController do
context 'when project is external' do context 'when project is external' do
it 'redirects to namespace_project_path' 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(flash[:notice]).to eq 'The project was successfully imported.'
expect(response).to redirect_to namespace_project_path(project.namespace, project) expect(response).to redirect_to namespace_project_path(project.namespace, project)
...@@ -97,7 +97,7 @@ describe Projects::ImportsController do ...@@ -97,7 +97,7 @@ describe Projects::ImportsController do
end end
it 'redirects to params[:to]' do 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(flash[:notice]).to eq params[:notice]
expect(response).to redirect_to params[:to] expect(response).to redirect_to params[:to]
...@@ -111,7 +111,7 @@ describe Projects::ImportsController do ...@@ -111,7 +111,7 @@ describe Projects::ImportsController do
end end
it 'redirects to namespace_project_path' 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(response).to redirect_to namespace_project_path(project.namespace, project) expect(response).to redirect_to namespace_project_path(project.namespace, project)
end end
......
...@@ -12,7 +12,7 @@ describe Projects::IssuesController do ...@@ -12,7 +12,7 @@ describe Projects::IssuesController do
allow(project).to receive(:external_issue_tracker).and_return(external) allow(project).to receive(:external_issue_tracker).and_return(external)
controller.instance_variable_set(:@project, project) 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') expect(response).to redirect_to('https://example.com/project')
end end
...@@ -27,13 +27,13 @@ describe Projects::IssuesController do ...@@ -27,13 +27,13 @@ describe Projects::IssuesController do
it_behaves_like "issuables list meta-data", :issue it_behaves_like "issuables list meta-data", :issue
it "returns index" do 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) expect(response).to have_http_status(200)
end end
it "returns 301 if request path doesn't match project path" do 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)) expect(response).to redirect_to(namespace_project_issues_path(project.namespace, project))
end end
...@@ -42,7 +42,7 @@ describe Projects::IssuesController do ...@@ -42,7 +42,7 @@ describe Projects::IssuesController do
project.issues_enabled = false project.issues_enabled = false
project.save 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) expect(response).to have_http_status(404)
end end
...@@ -50,7 +50,7 @@ describe Projects::IssuesController do ...@@ -50,7 +50,7 @@ describe Projects::IssuesController do
controller.instance_variable_set(:@project, project) controller.instance_variable_set(:@project, project)
allow(project).to receive(:default_issues_tracker?).and_return(false) 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) expect(response).to have_http_status(404)
end end
end end
...@@ -67,8 +67,8 @@ describe Projects::IssuesController do ...@@ -67,8 +67,8 @@ describe Projects::IssuesController do
it 'redirects to last_page if page number is larger than number of pages' do it 'redirects to last_page if page number is larger than number of pages' do
get :index, get :index,
namespace_id: project.namespace.path.to_param, namespace_id: project.namespace.to_param,
project_id: project.path.to_param, project_id: project,
page: (last_page + 1).to_param 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])) 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 ...@@ -76,8 +76,8 @@ describe Projects::IssuesController do
it 'redirects to specified page' do it 'redirects to specified page' do
get :index, get :index,
namespace_id: project.namespace.path.to_param, namespace_id: project.namespace.to_param,
project_id: project.path.to_param, project_id: project,
page: last_page.to_param page: last_page.to_param
expect(assigns(:issues).current_page).to eq(last_page) expect(assigns(:issues).current_page).to eq(last_page)
...@@ -94,7 +94,7 @@ describe Projects::IssuesController do ...@@ -94,7 +94,7 @@ describe Projects::IssuesController do
end end
it 'builds a new issue' do 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) expect(assigns(:issue)).to be_a_new(Issue)
end end
...@@ -104,7 +104,7 @@ describe Projects::IssuesController do ...@@ -104,7 +104,7 @@ describe Projects::IssuesController do
project_with_repository.team << [user, :developer] project_with_repository.team << [user, :developer]
mr = create(:merge_request_with_diff_notes, source_project: project_with_repository) 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).title).not_to be_empty
expect(assigns(:issue).description).not_to be_empty expect(assigns(:issue).description).not_to be_empty
...@@ -117,7 +117,7 @@ describe Projects::IssuesController do ...@@ -117,7 +117,7 @@ describe Projects::IssuesController do
allow(project).to receive(:external_issue_tracker).and_return(external) allow(project).to receive(:external_issue_tracker).and_return(external)
controller.instance_variable_set(:@project, project) 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') expect(response).to redirect_to('https://example.com/issues/new')
end end
...@@ -251,7 +251,7 @@ describe Projects::IssuesController do ...@@ -251,7 +251,7 @@ describe Projects::IssuesController do
def update_issue(issue_params = {}, additional_params = {}) def update_issue(issue_params = {}, additional_params = {})
params = { params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: issue.iid, id: issue.iid,
issue: issue_params issue: issue_params
}.merge(additional_params) }.merge(additional_params)
...@@ -262,7 +262,7 @@ describe Projects::IssuesController do ...@@ -262,7 +262,7 @@ describe Projects::IssuesController do
def move_issue def move_issue
put :update, put :update,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: issue.iid, id: issue.iid,
issue: { title: 'New title' }, issue: { title: 'New title' },
move_to_project_id: another_project.id move_to_project_id: another_project.id
...@@ -342,7 +342,7 @@ describe Projects::IssuesController do ...@@ -342,7 +342,7 @@ describe Projects::IssuesController do
def get_issues def get_issues
get :index, get :index,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param project_id: project
end end
end end
...@@ -405,7 +405,7 @@ describe Projects::IssuesController do ...@@ -405,7 +405,7 @@ describe Projects::IssuesController do
def go(id:) def go(id:)
get :show, get :show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id id: id
end end
end end
...@@ -416,7 +416,7 @@ describe Projects::IssuesController do ...@@ -416,7 +416,7 @@ describe Projects::IssuesController do
def go(id:) def go(id:)
get :edit, get :edit,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id id: id
end end
end end
...@@ -427,7 +427,7 @@ describe Projects::IssuesController do ...@@ -427,7 +427,7 @@ describe Projects::IssuesController do
def go(id:) def go(id:)
put :update, put :update,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id, id: id,
issue: { title: 'New title' } issue: { title: 'New title' }
end end
...@@ -442,7 +442,7 @@ describe Projects::IssuesController do ...@@ -442,7 +442,7 @@ describe Projects::IssuesController do
post :create, { post :create, {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
issue: { title: 'Title', description: 'Description' }.merge(issue_attrs) issue: { title: 'Title', description: 'Description' }.merge(issue_attrs)
}.merge(additional_params) }.merge(additional_params)
...@@ -464,7 +464,7 @@ describe Projects::IssuesController do ...@@ -464,7 +464,7 @@ describe Projects::IssuesController do
end end
def post_issue(issue_params) 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 end
it 'creates an issue for the project' do it 'creates an issue for the project' do
...@@ -607,8 +607,8 @@ describe Projects::IssuesController do ...@@ -607,8 +607,8 @@ describe Projects::IssuesController do
project.team << [admin, :master] project.team << [admin, :master]
sign_in(admin) sign_in(admin)
post :mark_as_spam, { post :mark_as_spam, {
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
id: issue.iid id: issue.iid
} }
end end
...@@ -624,7 +624,7 @@ describe Projects::IssuesController do ...@@ -624,7 +624,7 @@ describe Projects::IssuesController do
context "when the user is a developer" do context "when the user is a developer" do
before { sign_in(user) } before { sign_in(user) }
it "rejects a developer to destroy an issue" do 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) expect(response).to have_http_status(404)
end end
end end
...@@ -637,7 +637,7 @@ describe Projects::IssuesController do ...@@ -637,7 +637,7 @@ describe Projects::IssuesController do
before { sign_in(owner) } before { sign_in(owner) }
it "deletes the issue" do 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(response).to have_http_status(302)
expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./).now expect(controller).to set_flash[:notice].to(/The issue was successfully deleted\./).now
...@@ -646,7 +646,7 @@ describe Projects::IssuesController do ...@@ -646,7 +646,7 @@ describe Projects::IssuesController do
it 'delegates the update of the todos count cache to TodoService' 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 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 end
end end
...@@ -659,8 +659,8 @@ describe Projects::IssuesController do ...@@ -659,8 +659,8 @@ describe Projects::IssuesController do
it "toggles the award emoji" do it "toggles the award emoji" do
expect do expect do
post(:toggle_award_emoji, namespace_id: project.namespace.path, post(:toggle_award_emoji, namespace_id: project.namespace,
project_id: project.path, id: issue.iid, name: "thumbsup") project_id: project, id: issue.iid, name: "thumbsup")
end.to change { issue.award_emoji.count }.by(1) end.to change { issue.award_emoji.count }.by(1)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
......
...@@ -67,7 +67,7 @@ describe Projects::LabelsController do ...@@ -67,7 +67,7 @@ describe Projects::LabelsController do
end end
def list_labels 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
end end
...@@ -76,7 +76,7 @@ describe Projects::LabelsController do ...@@ -76,7 +76,7 @@ describe Projects::LabelsController do
let(:personal_project) { create(:empty_project, namespace: user.namespace) } let(:personal_project) { create(:empty_project, namespace: user.namespace) }
it 'creates labels' do 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) expect(response).to have_http_status(302)
end end
...@@ -84,7 +84,7 @@ describe Projects::LabelsController do ...@@ -84,7 +84,7 @@ describe Projects::LabelsController do
context 'project belonging to a group' do context 'project belonging to a group' do
it 'creates labels' 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) expect(response).to have_http_status(302)
end end
...@@ -109,7 +109,7 @@ describe Projects::LabelsController do ...@@ -109,7 +109,7 @@ describe Projects::LabelsController do
end end
def toggle_subscription(label) 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
end end
...@@ -119,7 +119,7 @@ describe Projects::LabelsController do ...@@ -119,7 +119,7 @@ describe Projects::LabelsController do
context 'not group owner' do context 'not group owner' do
it 'denies access' 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) expect(response).to have_http_status(404)
end end
...@@ -131,13 +131,13 @@ describe Projects::LabelsController do ...@@ -131,13 +131,13 @@ describe Projects::LabelsController do
end end
it 'gives access' do 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) expect(response).to redirect_to(namespace_project_labels_path)
end end
it 'promotes the label' do 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(Label.where(id: label_1.id)).to be_empty
expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil expect(GroupLabel.find_by(title: promoted_label_name)).not_to be_nil
...@@ -151,7 +151,7 @@ describe Projects::LabelsController do ...@@ -151,7 +151,7 @@ describe Projects::LabelsController do
end end
it 'returns to label list' do 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) expect(response).to redirect_to(namespace_project_labels_path)
end end
end end
......
...@@ -18,7 +18,7 @@ describe Projects::MattermostsController do ...@@ -18,7 +18,7 @@ describe Projects::MattermostsController do
it 'accepts the request' do it 'accepts the request' do
get(:new, get(:new,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param) project_id: project)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
end end
...@@ -30,7 +30,7 @@ describe Projects::MattermostsController do ...@@ -30,7 +30,7 @@ describe Projects::MattermostsController do
subject do subject do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
mattermost: mattermost_params) mattermost: mattermost_params)
end end
......
...@@ -17,8 +17,8 @@ describe Projects::PipelinesController do ...@@ -17,8 +17,8 @@ describe Projects::PipelinesController do
create(:ci_empty_pipeline, status: 'created', project: project) create(:ci_empty_pipeline, status: 'created', project: project)
create(:ci_empty_pipeline, status: 'success', project: project) create(:ci_empty_pipeline, status: 'success', project: project)
get :index, namespace_id: project.namespace.path, get :index, namespace_id: project.namespace,
project_id: project.path, project_id: project,
format: :json format: :json
end end
...@@ -62,8 +62,8 @@ describe Projects::PipelinesController do ...@@ -62,8 +62,8 @@ describe Projects::PipelinesController do
end end
def get_stage(name) def get_stage(name)
get :stage, namespace_id: project.namespace.path, get :stage, namespace_id: project.namespace,
project_id: project.path, project_id: project,
id: pipeline.id, id: pipeline.id,
stage: name, stage: name,
format: :json format: :json
......
...@@ -4,7 +4,7 @@ describe Projects::ProtectedBranchesController do ...@@ -4,7 +4,7 @@ describe Projects::ProtectedBranchesController do
describe "GET #index" do describe "GET #index" do
let(:project) { create(:project_empty_repo, :public) } let(:project) { create(:project_empty_repo, :public) }
it "redirects empty repo to projects page" do 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 end
end end
...@@ -10,7 +10,7 @@ describe Projects::RawController do ...@@ -10,7 +10,7 @@ describe Projects::RawController do
it 'delivers ASCII file' do it 'delivers ASCII file' do
get(:show, get(:show,
namespace_id: public_project.namespace.to_param, namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param, project_id: public_project,
id: id) id: id)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -27,7 +27,7 @@ describe Projects::RawController do ...@@ -27,7 +27,7 @@ describe Projects::RawController do
it 'sets image content type header' do it 'sets image content type header' do
get(:show, get(:show,
namespace_id: public_project.namespace.to_param, namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param, project_id: public_project,
id: id) id: id)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -51,7 +51,7 @@ describe Projects::RawController do ...@@ -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') expect(controller).to receive(:send_file).with("#{Gitlab.config.shared.path}/lfs-objects/91/ef/f75a492a3ed0dfcb544d7f31326bc4014c8551849c192fd1e48d4dd2c897", filename: "lfs_object.iso", disposition: 'attachment')
get(:show, get(:show,
namespace_id: public_project.namespace.to_param, namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param, project_id: public_project,
id: id) id: id)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -62,7 +62,7 @@ describe Projects::RawController do ...@@ -62,7 +62,7 @@ describe Projects::RawController do
it 'does not serve the file' do it 'does not serve the file' do
get(:show, get(:show,
namespace_id: public_project.namespace.to_param, namespace_id: public_project.namespace.to_param,
project_id: public_project.to_param, project_id: public_project,
id: id) id: id)
expect(response).to have_http_status(404) expect(response).to have_http_status(404)
......
...@@ -13,7 +13,7 @@ describe Projects::RefsController do ...@@ -13,7 +13,7 @@ describe Projects::RefsController do
def default_get(format = :html) def default_get(format = :html)
get :logs_tree, get :logs_tree,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: 'master', id: 'master',
path: 'foo/bar/baz.html', path: 'foo/bar/baz.html',
format: format format: format
...@@ -23,7 +23,7 @@ describe Projects::RefsController do ...@@ -23,7 +23,7 @@ describe Projects::RefsController do
xhr :get, xhr :get,
:logs_tree, :logs_tree,
namespace_id: project.namespace.to_param, 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 path: 'foo/bar/baz.html', format: format
end end
......
...@@ -16,7 +16,7 @@ describe Projects::ReleasesController do ...@@ -16,7 +16,7 @@ describe Projects::ReleasesController do
tag_id = release.tag tag_id = release.tag
project.releases.destroy_all 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) release = assigns(:release)
expect(release).not_to be_nil expect(release).not_to be_nil
...@@ -24,7 +24,7 @@ describe Projects::ReleasesController do ...@@ -24,7 +24,7 @@ describe Projects::ReleasesController do
end end
it 'retrieves an existing release' do 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) release = assigns(:release)
expect(release).not_to be_nil expect(release).not_to be_nil
...@@ -48,7 +48,7 @@ describe Projects::ReleasesController do ...@@ -48,7 +48,7 @@ describe Projects::ReleasesController do
def update_release(description) def update_release(description)
put :update, put :update,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
tag_id: release.tag, tag_id: release.tag,
release: { description: description } release: { description: description }
end end
......
...@@ -6,7 +6,7 @@ describe Projects::RepositoriesController do ...@@ -6,7 +6,7 @@ describe Projects::RepositoriesController do
describe "GET archive" do describe "GET archive" do
context 'as a guest' do context 'as a guest' do
it 'responds with redirect in correct format' 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.header["Content-Type"]).to start_with('text/html')
expect(response).to be_redirect expect(response).to be_redirect
...@@ -22,7 +22,7 @@ describe Projects::RepositoriesController do ...@@ -22,7 +22,7 @@ describe Projects::RepositoriesController do
end end
it "uses Gitlab::Workhorse" do 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:") expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end end
...@@ -33,7 +33,7 @@ describe Projects::RepositoriesController do ...@@ -33,7 +33,7 @@ describe Projects::RepositoriesController do
end end
it "renders Not Found" do 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) expect(response).to have_http_status(404)
end end
......
...@@ -17,16 +17,16 @@ describe Projects::SnippetsController do ...@@ -17,16 +17,16 @@ describe Projects::SnippetsController do
it 'redirects to last_page if page number is larger than number of pages' do it 'redirects to last_page if page number is larger than number of pages' do
get :index, get :index,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, page: (last_page + 1).to_param project_id: project, page: (last_page + 1).to_param
expect(response).to redirect_to(namespace_project_snippets_path(page: last_page)) expect(response).to redirect_to(namespace_project_snippets_path(page: last_page))
end end
it 'redirects to specified page' do it 'redirects to specified page' do
get :index, get :index,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, page: last_page.to_param project_id: project, page: last_page.to_param
expect(assigns(:snippets).current_page).to eq(last_page) expect(assigns(:snippets).current_page).to eq(last_page)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -38,7 +38,7 @@ describe Projects::SnippetsController do ...@@ -38,7 +38,7 @@ describe Projects::SnippetsController do
context 'when anonymous' do context 'when anonymous' do
it 'does not include the private snippet' 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(assigns(:snippets)).not_to include(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -49,7 +49,7 @@ describe Projects::SnippetsController do ...@@ -49,7 +49,7 @@ describe Projects::SnippetsController do
before { sign_in(user) } before { sign_in(user) }
it 'renders the snippet' do 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(assigns(:snippets)).to include(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -60,7 +60,7 @@ describe Projects::SnippetsController do ...@@ -60,7 +60,7 @@ describe Projects::SnippetsController do
before { sign_in(user2) } before { sign_in(user2) }
it 'renders the snippet' do 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(assigns(:snippets)).to include(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -77,7 +77,7 @@ describe Projects::SnippetsController do ...@@ -77,7 +77,7 @@ describe Projects::SnippetsController do
post :create, { post :create, {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params) project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params)
}.merge(additional_params) }.merge(additional_params)
end end
...@@ -152,7 +152,7 @@ describe Projects::SnippetsController do ...@@ -152,7 +152,7 @@ describe Projects::SnippetsController do
put :update, { put :update, {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: snippet.id, id: snippet.id,
project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params) project_snippet: { title: 'Title', content: 'Content' }.merge(snippet_params)
}.merge(additional_params) }.merge(additional_params)
...@@ -281,8 +281,8 @@ describe Projects::SnippetsController do ...@@ -281,8 +281,8 @@ describe Projects::SnippetsController do
sign_in(admin) sign_in(admin)
post :mark_as_spam, post :mark_as_spam,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
id: snippet.id id: snippet.id
end end
...@@ -300,7 +300,7 @@ describe Projects::SnippetsController do ...@@ -300,7 +300,7 @@ describe Projects::SnippetsController do
context 'when anonymous' do context 'when anonymous' do
it 'responds with status 404' 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) expect(response).to have_http_status(404)
end end
...@@ -310,7 +310,7 @@ describe Projects::SnippetsController do ...@@ -310,7 +310,7 @@ describe Projects::SnippetsController do
before { sign_in(user) } before { sign_in(user) }
it 'renders the snippet' do 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(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -321,7 +321,7 @@ describe Projects::SnippetsController do ...@@ -321,7 +321,7 @@ describe Projects::SnippetsController do
before { sign_in(user2) } before { sign_in(user2) }
it 'renders the snippet' do 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(assigns(:snippet)).to eq(project_snippet)
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
...@@ -332,7 +332,7 @@ describe Projects::SnippetsController do ...@@ -332,7 +332,7 @@ describe Projects::SnippetsController do
context 'when the project snippet does not exist' do context 'when the project snippet does not exist' do
context 'when anonymous' do context 'when anonymous' do
it 'responds with status 404' 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) expect(response).to have_http_status(404)
end end
...@@ -342,7 +342,7 @@ describe Projects::SnippetsController do ...@@ -342,7 +342,7 @@ describe Projects::SnippetsController do
before { sign_in(user) } before { sign_in(user) }
it 'responds with status 404' 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) expect(response).to have_http_status(404)
end end
...@@ -364,8 +364,8 @@ describe Projects::SnippetsController do ...@@ -364,8 +364,8 @@ describe Projects::SnippetsController do
context 'CRLF line ending' do context 'CRLF line ending' do
let(:params) do let(:params) do
{ {
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
id: project_snippet.to_param id: project_snippet.to_param
} }
end end
......
...@@ -6,7 +6,7 @@ describe Projects::TagsController do ...@@ -6,7 +6,7 @@ describe Projects::TagsController do
let!(:invalid_release) { create(:release, project: project, tag: 'does-not-exist') } let!(:invalid_release) { create(:release, project: project, tag: 'does-not-exist') }
describe 'GET index' do 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 it 'returns the tags for the page' do
expect(assigns(:tags).map(&:name)).to eq(['v1.1.0', 'v1.0.0']) expect(assigns(:tags).map(&:name)).to eq(['v1.1.0', 'v1.0.0'])
...@@ -19,7 +19,7 @@ describe Projects::TagsController do ...@@ -19,7 +19,7 @@ describe Projects::TagsController do
end end
describe 'GET show' do 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 context "valid tag" do
let(:id) { 'v1.0.0' } let(:id) { 'v1.0.0' }
......
...@@ -20,7 +20,7 @@ describe Projects::TemplatesController do ...@@ -20,7 +20,7 @@ describe Projects::TemplatesController do
describe '#show' do describe '#show' do
it 'renders template name and content as json' 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(response.status).to eq(200)
expect(body["name"]).to eq("bug") expect(body["name"]).to eq("bug")
...@@ -29,21 +29,21 @@ describe Projects::TemplatesController do ...@@ -29,21 +29,21 @@ describe Projects::TemplatesController do
it 'renders 404 when unauthorized' do it 'renders 404 when unauthorized' do
sign_in(user2) 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) expect(response.status).to eq(404)
end end
it 'renders 404 when template type is not found' do it 'renders 404 when template type is not found' do
sign_in(user) 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) expect(response.status).to eq(404)
end end
it 'renders 404 without errors' do it 'renders 404 without errors' do
sign_in(user) 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 end
end end
...@@ -12,8 +12,8 @@ describe Projects::TodosController do ...@@ -12,8 +12,8 @@ describe Projects::TodosController do
describe 'POST create' do describe 'POST create' do
def go def go
post :create, post :create,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
issuable_id: issue.id, issuable_id: issue.id,
issuable_type: 'issue', issuable_type: 'issue',
format: 'html' format: 'html'
...@@ -80,8 +80,8 @@ describe Projects::TodosController do ...@@ -80,8 +80,8 @@ describe Projects::TodosController do
describe 'POST create' do describe 'POST create' do
def go def go
post :create, post :create,
namespace_id: project.namespace.path, namespace_id: project.namespace,
project_id: project.path, project_id: project,
issuable_id: merge_request.id, issuable_id: merge_request.id,
issuable_type: 'merge_request', issuable_type: 'merge_request',
format: 'html' format: 'html'
......
...@@ -18,7 +18,7 @@ describe Projects::TreeController do ...@@ -18,7 +18,7 @@ describe Projects::TreeController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
...@@ -74,7 +74,7 @@ describe Projects::TreeController do ...@@ -74,7 +74,7 @@ describe Projects::TreeController do
before do before do
get(:show, get(:show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: id) id: id)
end end
...@@ -94,7 +94,7 @@ describe Projects::TreeController do ...@@ -94,7 +94,7 @@ describe Projects::TreeController do
before do before do
post(:create_dir, post(:create_dir,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: 'master', id: 'master',
dir_name: path, dir_name: path,
target_branch: target_branch, target_branch: target_branch,
......
...@@ -16,7 +16,7 @@ describe Projects::UploadsController do ...@@ -16,7 +16,7 @@ describe Projects::UploadsController do
it "returns an error" do it "returns an error" do
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
format: :json format: :json
expect(response).to have_http_status(422) expect(response).to have_http_status(422)
end end
...@@ -26,7 +26,7 @@ describe Projects::UploadsController do ...@@ -26,7 +26,7 @@ describe Projects::UploadsController do
before do before do
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
file: jpg, file: jpg,
format: :json format: :json
end end
...@@ -41,7 +41,7 @@ describe Projects::UploadsController do ...@@ -41,7 +41,7 @@ describe Projects::UploadsController do
before do before do
post :create, post :create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
file: txt, file: txt,
format: :json format: :json
end end
...@@ -57,7 +57,7 @@ describe Projects::UploadsController do ...@@ -57,7 +57,7 @@ describe Projects::UploadsController do
let(:go) do let(:go) do
get :show, get :show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
secret: "123456", secret: "123456",
filename: "image.jpg" filename: "image.jpg"
end end
......
...@@ -12,7 +12,7 @@ describe Projects::VariablesController do ...@@ -12,7 +12,7 @@ describe Projects::VariablesController do
describe 'POST #create' do describe 'POST #create' do
context 'variable is valid' do context 'variable is valid' do
it 'shows a success flash message' 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" } variable: { key: "one", value: "two" }
expect(flash[:notice]).to include 'Variables were successfully updated.' expect(flash[:notice]).to include 'Variables were successfully updated.'
...@@ -22,7 +22,7 @@ describe Projects::VariablesController do ...@@ -22,7 +22,7 @@ describe Projects::VariablesController do
context 'variable is invalid' do context 'variable is invalid' do
it 'shows an alert flash message' 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" } variable: { key: "..one", value: "two" }
expect(response).to render_template("projects/variables/show") expect(response).to render_template("projects/variables/show")
...@@ -40,7 +40,7 @@ describe Projects::VariablesController do ...@@ -40,7 +40,7 @@ describe Projects::VariablesController do
end end
it 'shows a success flash message' do 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' } id: variable.id, variable: { key: variable.key, value: 'two' }
expect(flash[:notice]).to include 'Variable was successfully updated.' expect(flash[:notice]).to include 'Variable was successfully updated.'
...@@ -48,7 +48,7 @@ describe Projects::VariablesController do ...@@ -48,7 +48,7 @@ describe Projects::VariablesController do
end end
it 'renders the action #show if the variable key is invalid' do 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 } id: variable.id, variable: { key: '?', value: variable.value }
expect(response).to have_http_status(200) expect(response).to have_http_status(200)
......
...@@ -12,7 +12,7 @@ feature 'Project member activity', feature: true, js: true do ...@@ -12,7 +12,7 @@ feature 'Project member activity', feature: true, js: true do
def visit_activities_and_wait_with_event(event_type) def visit_activities_and_wait_with_event(event_type)
Event.create(project: project, author_id: user.id, action: 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 wait_for_ajax
end end
......
...@@ -85,7 +85,7 @@ feature 'Projects > Members > Sorting', feature: true do ...@@ -85,7 +85,7 @@ feature 'Projects > Members > Sorting', feature: true do
end end
def visit_members_list(sort:) 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 end
def first_member def first_member
......
...@@ -58,7 +58,7 @@ describe ApplicationHelper do ...@@ -58,7 +58,7 @@ describe ApplicationHelper do
project = create(:empty_project, avatar: File.open(uploaded_image_temp_path)) 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" 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\" />" to eq "<img src=\"#{avatar_url}\" alt=\"Banana sample\" />"
end end
...@@ -68,7 +68,7 @@ describe ApplicationHelper do ...@@ -68,7 +68,7 @@ describe ApplicationHelper do
allow_any_instance_of(Project).to receive(:avatar_in_git).and_return(true) 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)}" 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)) image_tag(avatar_url))
end end
end end
......
...@@ -20,7 +20,7 @@ describe Projects::BranchesController, '(JavaScript fixtures)', type: :controlle ...@@ -20,7 +20,7 @@ describe Projects::BranchesController, '(JavaScript fixtures)', type: :controlle
it 'branches/new_branch.html.raw' do |example| it 'branches/new_branch.html.raw' do |example|
get :new, get :new,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param project_id: project
expect(response).to be_success expect(response).to be_success
store_frontend_fixture(response, example.description) store_frontend_fixture(response, example.description)
......
...@@ -24,7 +24,7 @@ describe Projects::BuildsController, '(JavaScript fixtures)', type: :controller ...@@ -24,7 +24,7 @@ describe Projects::BuildsController, '(JavaScript fixtures)', type: :controller
it 'builds/build-with-artifacts.html.raw' do |example| it 'builds/build-with-artifacts.html.raw' do |example|
get :show, get :show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: build_with_artifacts.to_param id: build_with_artifacts.to_param
expect(response).to be_success expect(response).to be_success
......
...@@ -41,7 +41,7 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller ...@@ -41,7 +41,7 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller
def render_issue(fixture_file_name, issue) def render_issue(fixture_file_name, issue)
get :show, get :show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: issue.to_param id: issue.to_param
expect(response).to be_success expect(response).to be_success
......
...@@ -27,7 +27,7 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont ...@@ -27,7 +27,7 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
def render_merge_request(fixture_file_name, merge_request) def render_merge_request(fixture_file_name, merge_request)
get :show, get :show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project,
id: merge_request.to_param id: merge_request.to_param
expect(response).to be_success expect(response).to be_success
......
...@@ -20,7 +20,7 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do ...@@ -20,7 +20,7 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do
it 'projects/dashboard.html.raw' do |example| it 'projects/dashboard.html.raw' do |example|
get :show, get :show,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
id: project.to_param id: project
expect(response).to be_success expect(response).to be_success
store_frontend_fixture(response, example.description) store_frontend_fixture(response, example.description)
......
...@@ -39,8 +39,8 @@ describe 'Todos (JavaScript fixtures)' do ...@@ -39,8 +39,8 @@ describe 'Todos (JavaScript fixtures)' do
it 'todos/todos.json' do |example| it 'todos/todos.json' do |example|
post :create, post :create,
namespace_id: namespace.path, namespace_id: namespace,
project_id: project.path, project_id: project,
issuable_type: 'issue', issuable_type: 'issue',
issuable_id: issue_2.id, issuable_id: issue_2.id,
format: 'json' format: 'json'
......
...@@ -6,7 +6,7 @@ describe ProjectUrlConstrainer, lib: true do ...@@ -6,7 +6,7 @@ describe ProjectUrlConstrainer, lib: true do
describe '#matches?' do describe '#matches?' do
context 'valid request' 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 } it { expect(subject.matches?(request)).to be_truthy }
end end
...@@ -19,7 +19,7 @@ describe ProjectUrlConstrainer, lib: true do ...@@ -19,7 +19,7 @@ describe ProjectUrlConstrainer, lib: true do
end end
context "project id ending with .git" do 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 } it { expect(subject.matches?(request)).to be_falsey }
end end
......
...@@ -251,7 +251,7 @@ FILE ...@@ -251,7 +251,7 @@ FILE
describe '#as_json' do describe '#as_json' do
it 'includes the blob path for the file' do it 'includes the blob path for the file' do
expect(conflict_file.as_json[:blob_path]). 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 end
it 'includes the blob icon for the file' do it 'includes the blob icon for the file' do
......
...@@ -51,8 +51,8 @@ describe Gitlab::Regex, lib: true do ...@@ -51,8 +51,8 @@ describe Gitlab::Regex, lib: true do
it { is_expected.not_to match('foo-') } it { is_expected.not_to match('foo-') }
end end
describe 'NAMESPACE_REF_REGEX_STR' do describe 'FULL_NAMESPACE_REGEX_STR' do
subject { %r{\A#{Gitlab::Regex::NAMESPACE_REF_REGEX_STR}\z} } subject { %r{\A#{Gitlab::Regex::FULL_NAMESPACE_REGEX_STR}\z} }
it { is_expected.to match('gitlab.org') } it { is_expected.to match('gitlab.org') }
it { is_expected.to match('gitlab.org/gitlab-git') } it { is_expected.to match('gitlab.org/gitlab-git') }
......
...@@ -1239,8 +1239,8 @@ describe Ci::Build, :models do ...@@ -1239,8 +1239,8 @@ describe Ci::Build, :models do
{ key: 'CI_SERVER_REVISION', value: Gitlab::REVISION, public: true }, { key: 'CI_SERVER_REVISION', value: Gitlab::REVISION, public: true },
{ key: 'CI_PROJECT_ID', value: project.id.to_s, 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_NAME', value: project.path, public: true },
{ key: 'CI_PROJECT_PATH', value: project.path_with_namespace, public: true }, { key: 'CI_PROJECT_PATH', value: project.full_path, public: true },
{ key: 'CI_PROJECT_NAMESPACE', value: project.namespace.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_PROJECT_URL', value: project.web_url, public: true },
{ key: 'CI_PIPELINE_ID', value: pipeline.id.to_s, public: true } { key: 'CI_PIPELINE_ID', value: pipeline.id.to_s, public: true }
] ]
......
...@@ -86,7 +86,7 @@ describe Group, 'Routable' do ...@@ -86,7 +86,7 @@ describe Group, 'Routable' do
let(:nested_group) { create(:group, parent: group) } let(:nested_group) { create(:group, parent: group) }
it { expect(group.full_path).to eq(group.path) } 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 end
describe '#full_name' do describe '#full_name' do
...@@ -102,7 +102,7 @@ describe Project, 'Routable' do ...@@ -102,7 +102,7 @@ describe Project, 'Routable' do
describe '#full_path' do describe '#full_path' do
let(:project) { build_stubbed(:empty_project) } 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 end
describe '#full_name' do describe '#full_name' do
......
...@@ -36,7 +36,7 @@ describe Namespace, models: true do ...@@ -36,7 +36,7 @@ describe Namespace, models: true do
end end
describe '#to_param' do describe '#to_param' do
it { expect(namespace.to_param).to eq(namespace.path) } it { expect(namespace.to_param).to eq(namespace.full_path) }
end end
describe '#human_name' do describe '#human_name' do
...@@ -151,7 +151,7 @@ describe Namespace, models: true do ...@@ -151,7 +151,7 @@ describe Namespace, models: true do
describe :rm_dir do describe :rm_dir do
let!(:project) { create(:empty_project, namespace: namespace) } 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 it "removes its dirs when deleted" do
namespace.destroy namespace.destroy
......
...@@ -28,7 +28,7 @@ describe DroneCiService, models: true, caching: true do ...@@ -28,7 +28,7 @@ describe DroneCiService, models: true, caching: true do
shared_context :drone_ci_service do shared_context :drone_ci_service do
let(:drone) { DroneCiService.new } let(:drone) { DroneCiService.new }
let(:project) { create(:project, :repository, name: 'project') } 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(:drone_url) { 'http://drone.example.com' }
let(:sha) { '2ab7834c' } let(:sha) { '2ab7834c' }
let(:branch) { 'dev' } let(:branch) { 'dev' }
......
...@@ -402,7 +402,7 @@ describe Project, models: true do ...@@ -402,7 +402,7 @@ describe Project, models: true do
let(:project) { create(:empty_project, path: "somewhere") } let(:project) { create(:empty_project, path: "somewhere") }
it 'returns the full web URL for this repo' do 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
end end
...@@ -803,7 +803,7 @@ describe Project, models: true do ...@@ -803,7 +803,7 @@ describe Project, models: true do
end end
let(:avatar_path) do let(:avatar_path) do
"/#{project.namespace.name}/#{project.path}/avatar" "/#{project.full_path}/avatar"
end end
it { should eq "http://#{Gitlab.config.gitlab.host}#{avatar_path}" } it { should eq "http://#{Gitlab.config.gitlab.host}#{avatar_path}" }
...@@ -1148,16 +1148,14 @@ describe Project, models: true do ...@@ -1148,16 +1148,14 @@ describe Project, models: true do
end end
it 'renames a repository' do it 'renames a repository' do
ns = project.namespace_dir
expect(gitlab_shell).to receive(:mv_repository). expect(gitlab_shell).to receive(:mv_repository).
ordered. 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) and_return(true)
expect(gitlab_shell).to receive(:mv_repository). expect(gitlab_shell).to receive(:mv_repository).
ordered. 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) and_return(true)
expect_any_instance_of(SystemHooksService). expect_any_instance_of(SystemHooksService).
...@@ -1166,7 +1164,7 @@ describe Project, models: true do ...@@ -1166,7 +1164,7 @@ describe Project, models: true do
expect_any_instance_of(Gitlab::UploadsTransfer). expect_any_instance_of(Gitlab::UploadsTransfer).
to receive(:rename_project). 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) expect(project).to receive(:expire_caches_before_rename)
...@@ -1538,7 +1536,7 @@ describe Project, models: true do ...@@ -1538,7 +1536,7 @@ describe Project, models: true do
it 'schedules a RepositoryForkWorker job' do it 'schedules a RepositoryForkWorker job' do
expect(RepositoryForkWorker).to receive(:perform_async). expect(RepositoryForkWorker).to receive(:perform_async).
with(project.id, forked_from_project.repository_storage_path, 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 project.add_import_job
end end
...@@ -1752,7 +1750,7 @@ describe Project, models: true do ...@@ -1752,7 +1750,7 @@ describe Project, models: true do
describe 'inside_path' do describe 'inside_path' do
let!(:project1) { create(:empty_project) } let!(:project1) { create(:empty_project) }
let!(:project2) { 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]) } it { expect(Project.inside_path(path)).to eq([project1]) }
end end
......
...@@ -148,7 +148,7 @@ describe API::Commits, api: true do ...@@ -148,7 +148,7 @@ describe API::Commits, api: true do
end end
context 'with project path in URL' do 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 it 'a new file in project repo' do
post api(url, user), valid_c_params post api(url, user), valid_c_params
......
...@@ -519,7 +519,7 @@ describe API::Groups, api: true do ...@@ -519,7 +519,7 @@ describe API::Groups, api: true do
describe "POST /groups/:id/projects/:project_id" do describe "POST /groups/:id/projects/:project_id" do
let(:project) { create(:empty_project) } 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 before(:each) do
allow_any_instance_of(Projects::TransferService). allow_any_instance_of(Projects::TransferService).
......
...@@ -148,7 +148,7 @@ describe API::V3::Commits, api: true do ...@@ -148,7 +148,7 @@ describe API::V3::Commits, api: true do
end end
context 'with project path in URL' do 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 it 'a new file in project repo' do
post v3_api(url, user), valid_c_params post v3_api(url, user), valid_c_params
......
...@@ -22,7 +22,7 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil| ...@@ -22,7 +22,7 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
if action if action
get action get action
else else
get :index, namespace_id: project.namespace.path, project_id: project.path get :index, namespace_id: project.namespace, project_id: project
end end
meta_data = assigns(:issuable_meta_data) meta_data = assigns(:issuable_meta_data)
......
...@@ -79,8 +79,9 @@ class MarkdownFeature ...@@ -79,8 +79,9 @@ class MarkdownFeature
def xproject def xproject
@xproject ||= begin @xproject ||= begin
namespace = create(:namespace, name: 'cross-reference') group = create(:group, name: 'cross-reference')
create(:project, namespace: namespace) do |project| group2 = create(:group, parent: group, name: 'nested-group')
create(:project, namespace: group2) do |project|
project.team << [user, :developer] project.team << [user, :developer]
end end
end end
......
...@@ -135,7 +135,7 @@ module TestEnv ...@@ -135,7 +135,7 @@ module TestEnv
def copy_repo(project) def copy_repo(project)
base_repo_path = File.expand_path(factory_repo_path_bare) 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.mkdir_p(target_repo_path)
FileUtils.cp_r("#{base_repo_path}/.", target_repo_path) FileUtils.cp_r("#{base_repo_path}/.", target_repo_path)
FileUtils.chmod_R 0755, target_repo_path FileUtils.chmod_R 0755, target_repo_path
...@@ -152,7 +152,7 @@ module TestEnv ...@@ -152,7 +152,7 @@ module TestEnv
def copy_forked_repo_with_submodules(project) def copy_forked_repo_with_submodules(project)
base_repo_path = File.expand_path(forked_repo_path_bare) 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.mkdir_p(target_repo_path)
FileUtils.cp_r("#{base_repo_path}/.", target_repo_path) FileUtils.cp_r("#{base_repo_path}/.", target_repo_path)
FileUtils.chmod_R 0755, target_repo_path FileUtils.chmod_R 0755, target_repo_path
......
...@@ -15,24 +15,24 @@ describe RepositoryForkWorker do ...@@ -15,24 +15,24 @@ describe RepositoryForkWorker do
it "creates a new repository from a fork" do it "creates a new repository from a fork" do
expect(shell).to receive(:fork_repository).with( expect(shell).to receive(:fork_repository).with(
'/test/path', '/test/path',
project.path_with_namespace, project.full_path,
project.repository_storage_path, project.repository_storage_path,
fork_project.namespace.path fork_project.namespace.full_path
).and_return(true) ).and_return(true)
subject.perform( subject.perform(
project.id, project.id,
'/test/path', '/test/path',
project.path_with_namespace, project.full_path,
fork_project.namespace.path) fork_project.namespace.full_path)
end end
it 'flushes various caches' do it 'flushes various caches' do
expect(shell).to receive(:fork_repository).with( expect(shell).to receive(:fork_repository).with(
'/test/path', '/test/path',
project.path_with_namespace, project.full_path,
project.repository_storage_path, project.repository_storage_path,
fork_project.namespace.path fork_project.namespace.full_path
).and_return(true) ).and_return(true)
expect_any_instance_of(Repository).to receive(:expire_emptiness_caches). expect_any_instance_of(Repository).to receive(:expire_emptiness_caches).
...@@ -41,8 +41,8 @@ describe RepositoryForkWorker do ...@@ -41,8 +41,8 @@ describe RepositoryForkWorker do
expect_any_instance_of(Repository).to receive(:expire_exists_cache). expect_any_instance_of(Repository).to receive(:expire_exists_cache).
and_call_original and_call_original
subject.perform(project.id, '/test/path', project.path_with_namespace, subject.perform(project.id, '/test/path', project.full_path,
fork_project.namespace.path) fork_project.namespace.full_path)
end end
it "handles bad fork" do it "handles bad fork" do
...@@ -53,8 +53,8 @@ describe RepositoryForkWorker do ...@@ -53,8 +53,8 @@ describe RepositoryForkWorker do
subject.perform( subject.perform(
project.id, project.id,
'/test/path', '/test/path',
project.path_with_namespace, project.full_path,
fork_project.namespace.path) fork_project.namespace.full_path)
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment