FEATURE: Autolinking to category using hashtags.

This commit is contained in:
Guo Xiang Tan
2015-12-28 14:28:16 +08:00
parent b8471177dc
commit c1dbf5c1c4
20 changed files with 365 additions and 14 deletions

View File

@@ -503,6 +503,22 @@ describe Category do
end
end
describe "#url_with_id" do
let(:category) { Fabricate(:category, name: 'cats') }
it "includes the id in the URL" do
expect(category.url_with_id).to eq("/c/#{category.id}-cats")
end
context "child category" do
let(:child_category) { Fabricate(:category, parent_category_id: category.id, name: 'dogs') }
it "includes the id in the URL" do
expect(child_category.url_with_id).to eq("/c/cats/dogs/#{child_category.id}")
end
end
end
describe "uncategorized" do
let(:cat) { Category.where(id: SiteSetting.uncategorized_category_id).first }