Commit ff1e730b authored by John Hope's avatar John Hope

Subgroup links should use the subgroup full path

parent 7c4295a1
......@@ -249,7 +249,7 @@ module MilestonesHelper
if milestone.legacy_group_milestone?
group_milestone_path(@group, milestone.safe_title, title: milestone.title, milestone: params)
else
group_milestone_path(@group, milestone.iid, milestone: params)
group_milestone_path(milestone.group, milestone.iid, milestone: params)
end
end
......
......@@ -85,4 +85,19 @@ describe MilestonesHelper do
end
end
end
describe "#group_milestone_route" do
let(:group) { build_stubbed(:group) }
let(:subgroup) { build_stubbed(:group, parent: group, name: "Test Subgrp") }
context "when in subgroup" do
let(:milestone) { build_stubbed(:group_milestone, group: subgroup) }
it 'generates correct url despite assigned @group' do
assign(:group, group)
milestone_path = "/groups/#{subgroup.full_path}/-/milestones/#{milestone.iid}"
expect(helper.group_milestone_route(milestone)).to eq(milestone_path)
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