Fix bug when links in tabs of the labels index pages ends with .html

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2018-10-31 16:47:53 +02:00
parent 116117084c
commit 6f11593774
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
3 changed files with 31 additions and 1 deletions

View file

@ -143,7 +143,7 @@ module LabelsHelper
def labels_filter_path(options = {})
project = @target_project || @project
format = options.delete(:format) || :html
format = options.delete(:format)
if project
project_labels_path(project, format, options)

View file

@ -0,0 +1,5 @@
---
title: Fix bug when links in tabs of the labels index pages ends with .html
merge_request: 22716
author:
type: fixed

View file

@ -211,4 +211,29 @@ describe LabelsHelper do
end
end
end
describe 'labels_filter_path' do
let(:group) { create(:group) }
let(:project) { create(:project) }
it 'links to the dashboard labels page' do
expect(labels_filter_path).to eq(dashboard_labels_path)
end
it 'links to the group labels page' do
assign(:group, group)
expect(helper.labels_filter_path).to eq(group_labels_path(group))
end
it 'links to the group labels page' do
assign(:project, project)
expect(helper.labels_filter_path).to eq(project_labels_path(project))
end
it 'supports json format' do
expect(labels_filter_path(format: :json)).to eq(dashboard_labels_path(format: :json))
end
end
end