mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 05:41:39 +08:00
FEATURE: Autolinking to category using hashtags.
This commit is contained in:
@ -83,6 +83,26 @@ describe ListController do
|
||||
it { is_expected.to respond_with(:success) }
|
||||
end
|
||||
|
||||
context 'with a link that has a parent slug, slug and id in its path' do
|
||||
let(:child_category) { Fabricate(:category, parent_category: category) }
|
||||
|
||||
context "with valid slug" do
|
||||
before do
|
||||
xhr :get, :category_latest, parent_category: category.slug, category: child_category.slug, id: child_category.id
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to(child_category.url) }
|
||||
end
|
||||
|
||||
context "with invalid slug" do
|
||||
before do
|
||||
xhr :get, :category_latest, parent_category: 'random slug', category: 'random slug', id: child_category.id
|
||||
end
|
||||
|
||||
it { is_expected.to redirect_to(child_category.url) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'another category exists with a number at the beginning of its name' do
|
||||
# One category has another category's id at the beginning of its name
|
||||
let!(:other_category) { Fabricate(:category, name: "#{category.id} name") }
|
||||
|
Reference in New Issue
Block a user