Commit 77efa66c authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'get-rid-of-user-namespace-method' into 'master'

Get rid of the user_namespace API helper method

See merge request gitlab-org/gitlab-ce!27636
parents 97678c09 c563e29f
...@@ -67,10 +67,6 @@ module API ...@@ -67,10 +67,6 @@ module API
initial_current_user != current_user initial_current_user != current_user
end end
def user_namespace
@user_namespace ||= find_namespace!(params[:id])
end
def user_group def user_group
@group ||= find_group!(params[:id]) @group ||= find_group!(params[:id])
end end
......
...@@ -44,6 +44,8 @@ module API ...@@ -44,6 +44,8 @@ module API
requires :id, type: String, desc: "Namespace's ID or path" requires :id, type: String, desc: "Namespace's ID or path"
end end
get ':id', requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do get ':id', requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
user_namespace = find_namespace!(params[:id])
present user_namespace, with: Entities::Namespace, current_user: current_user present user_namespace, with: Entities::Namespace, current_user: current_user
end end
end end
......
...@@ -137,18 +137,6 @@ describe API::Helpers do ...@@ -137,18 +137,6 @@ describe API::Helpers do
it_behaves_like 'user namespace finder' it_behaves_like 'user namespace finder'
end end
describe '#user_namespace' do
let(:namespace_finder) do
subject.user_namespace
end
before do
allow(subject).to receive(:params).and_return({ id: namespace.id })
end
it_behaves_like 'user namespace finder'
end
describe '#send_git_blob' do describe '#send_git_blob' do
let(:repository) { double } let(:repository) { double }
let(:blob) { double(name: 'foobar') } let(:blob) { double(name: 'foobar') }
......
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