Commit 0d9e80c3 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix 500 error for Group#web_url method if nested group

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent a89aab9c
...@@ -19,13 +19,11 @@ end ...@@ -19,13 +19,11 @@ end
scope(path: 'groups/*id', scope(path: 'groups/*id',
controller: :groups, controller: :groups,
constraints: { id: Gitlab::Regex.namespace_route_regex }) do constraints: { id: Gitlab::Regex.namespace_route_regex, format: /(html|json|atom)/ }) do
get :edit, as: :edit_group get :edit, as: :edit_group
get :issues, as: :issues_group get :issues, as: :issues_group
get :merge_requests, as: :merge_requests_group get :merge_requests, as: :merge_requests_group
get :projects, as: :projects_group get :projects, as: :projects_group
get :activity, as: :activity_group get :activity, as: :activity_group
get '/', action: :show, as: :group_canonical
end end
# Must be last route in this file
get 'groups/*id' => 'groups#show', as: :group_canonical, constraints: { id: Gitlab::Regex.namespace_route_regex }
...@@ -269,6 +269,12 @@ describe Group, models: true do ...@@ -269,6 +269,12 @@ describe Group, models: true do
it 'returns the canonical URL' do it 'returns the canonical URL' do
expect(group.web_url).to include("groups/#{group.name}") expect(group.web_url).to include("groups/#{group.name}")
end end
context 'nested group' do
let(:nested_group) { create(:group, :nested) }
it { expect(nested_group.web_url).to include("groups/#{nested_group.full_path}") }
end
end end
describe 'nested group' do describe 'nested group' do
......
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