Commit b6446f61 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '354058-fix-nomethoderror-for-repo-analytics' into 'master'

Fix NoMethodError when visiting repo analytics

See merge request gitlab-org/gitlab!81988
parents 76844015 afcedad0
......@@ -20,4 +20,8 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl
namespace: @group
}
end
def build_canonical_path(group)
url_for(safe_params.merge(group_id: group.to_param))
end
end
......@@ -35,6 +35,22 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
)
end
context 'when requesting a redirected path' do
let(:redirect_route) { group.redirect_routes.create!(path: 'old-path') }
let(:group_full_path) { redirect_route.path }
before do
allow(request).to receive(:original_fullpath).and_return("/#{group_full_path}")
end
it 'redirects to the canonical path' do
get :show, params: { group_id: group_full_path }
expect(response).to redirect_to(group_analytics_repository_analytics_path(group))
expect(controller).to set_flash[:notice].to(/Please update any links and bookmarks/)
end
end
context 'when license is missing' do
before do
stub_licensed_features(feature_name => false)
......
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