Update TagsController#index query (#15202)
* Update TagsController#index query to include empty string * Update spec
This commit is contained in:
parent
c5a5c9c382
commit
3c204c236d
2 changed files with 5 additions and 2 deletions
|
|
@ -17,7 +17,7 @@ class TagsController < ApplicationController
|
|||
def index
|
||||
skip_authorization
|
||||
@tags_index = true
|
||||
@tags = Tag.where(alias_for: nil).includes(:sponsorship).order(hotness_score: :desc).limit(100)
|
||||
@tags = Tag.where(alias_for: [nil, ""]).includes(:sponsorship).order(hotness_score: :desc).limit(100)
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@ require "rails_helper"
|
|||
RSpec.describe "Tags", type: :request, proper_status: true do
|
||||
describe "GET /tags" do
|
||||
it "returns proper page" do
|
||||
create(:tag, name: "ruby")
|
||||
create(:tag, name: "javascript", alias_for: "")
|
||||
|
||||
get tags_path
|
||||
expect(response.body).to include("Top tags")
|
||||
expect(response.body).to include("Top tags", "ruby", "javascript")
|
||||
end
|
||||
|
||||
it "does not include tags with alias" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue