DEV: Add specs for hashtags related code (#18526)

Adding a couple of small specs to code around hashtags
for tags and categories since I will be working in this
area soon and these were not covered.
This commit is contained in:
Martin Brennan
2022-10-11 09:04:51 +10:00
committed by GitHub
parent dc89b72d46
commit cab173d3b5
2 changed files with 41 additions and 0 deletions

View File

@@ -32,6 +32,16 @@ RSpec.describe HashtagsController do
)
end
it "handles tags with the TAG_HASHTAG_POSTFIX" do
get "/hashtags.json", params: { slugs: ["#{tag.name}#{PrettyText::Helpers::TAG_HASHTAG_POSTFIX}"] }
expect(response.status).to eq(200)
expect(response.parsed_body).to eq(
"categories" => {},
"tags" => { tag.name => tag.full_url }
)
end
it "does not return restricted categories or hidden tags" do
get "/hashtags.json", params: { slugs: [private_category.slug, hidden_tag.name] }