FIX: newly created categories were not showing up

This commit is contained in:
Arpit Jalan
2016-03-14 22:08:29 +05:30
parent 7e97724341
commit ff12b5bf57
6 changed files with 50 additions and 3 deletions

View File

@ -583,4 +583,14 @@ describe Category do
end
end
describe "find_by_slug" do
it "finds with category and sub category" do
category = Fabricate(:category, slug: 'awesome-category')
sub_category = Fabricate(:category, parent_category_id: category.id, slug: 'awesome-sub-category')
expect(Category.find_by_slug('awesome-category')).to eq(category)
expect(Category.find_by_slug('awesome-sub-category', 'awesome-category')).to eq(sub_category)
end
end
end