FIX: Use declared constant.
This commit is contained in:
parent
61cc776fdd
commit
0812807a53
|
@ -5,7 +5,7 @@ module CategoryHashtag
|
|||
|
||||
class_methods do
|
||||
def query_from_hashtag_slug(category_slug)
|
||||
parent_slug, child_slug = category_slug.split(":", 2)
|
||||
parent_slug, child_slug = category_slug.split(SEPARATOR, 2)
|
||||
|
||||
category = Category.where(slug: parent_slug, parent_category_id: nil)
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ describe CategoryHashtag do
|
|||
end
|
||||
|
||||
it "should return the right result for a parent and child category slug" do
|
||||
expect(Category.query_from_hashtag_slug("#{parent_category.slug}:#{child_category.slug}"))
|
||||
expect(Category.query_from_hashtag_slug("#{parent_category.slug}#{CategoryHashtag::SEPARATOR}#{child_category.slug}"))
|
||||
.to eq(child_category)
|
||||
end
|
||||
|
||||
|
@ -20,7 +20,7 @@ describe CategoryHashtag do
|
|||
end
|
||||
|
||||
it "should return nil for incorrect parent and child category slug" do
|
||||
expect(Category.query_from_hashtag_slug("random-slug:random-slug")).to eq(nil)
|
||||
expect(Category.query_from_hashtag_slug("random-slug#{CategoryHashtag::SEPARATOR}random-slug")).to eq(nil)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue