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

@ -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") }