FIX: tags can be filtered on categoryId without a q param (#8264)

This commit is contained in:
Joffrey JAFFEUX
2019-10-31 01:16:23 +01:00
committed by Martin Brennan
parent 7a264217f2
commit 0ba28e344b
2 changed files with 32 additions and 12 deletions

View File

@@ -395,6 +395,14 @@ describe TagsController do
category_names: category.name
))
end
it "can filter on category without q param" do
nope = Fabricate(:tag, name: 'nope')
get "/tags/filter/search.json", params: { categoryId: category.id }
expect(response.status).to eq(200)
json = ::JSON.parse(response.body)
expect(json["results"].map { |j| j["id"] }.sort).to eq([yup.name])
end
end
it "matches tags after sanitizing input" do