Merge pull request #1960 from verg/subcategory-search-links

Fix subcategories links from search
This commit is contained in:
Sam
2014-02-17 10:33:35 +11:00
3 changed files with 22 additions and 1 deletions
+15
View File
@@ -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) }