mirror of
https://github.com/discourse/discourse.git
synced 2026-08-26 21:27:16 -05:00
Merge pull request #1960 from verg/subcategory-search-links
Fix subcategories links from search
This commit is contained in:
@@ -348,6 +348,21 @@ describe Category do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#url" do
|
||||
it "builds a url for normal categories" do
|
||||
category = Fabricate(:category, name: "cats")
|
||||
expect(category.url).to eq "/category/cats"
|
||||
end
|
||||
|
||||
describe "for subcategories" do
|
||||
it "includes the parent category" do
|
||||
parent_category = Fabricate(:category, name: "parent")
|
||||
subcategory = Fabricate(:category, name: "child",
|
||||
parent_category_id: parent_category.id)
|
||||
expect(subcategory.url).to eq "/category/parent/child"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "parent categories" do
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
Reference in New Issue
Block a user